Error jquery plugin why?

Hi, I am using the following pugin from jquery

when the data in (querytorun) is the string below the error statement runs why?

I have attached the plug-in also


hopefully some one can help. many thanks
when querytorun =
select * from tbl_module_qualification_credits where tbl_module_qualification_credits.qc_advanced_credits=<cfqueryPARAM value="0" CFSQLType="ANY"> 

I get the error function why?    

  $.ajax({    
            type:    'POST',    
            url:     'query.cfm',   
            data:    'querytorun='+$('p#3000').html(),    
            error:   function(){ $('p#4000').html("Error with SQL"); },    
            success: function(data) { $('p#4000').html(data);}    
        });

Open in new window

jquery.sqlbuilder-0.06.js
LVL 12
pigmentartsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve KrileCommented:
My guess is the data line contains a string with some illegal character (like quotes or double quotes).

I'm not sure there is a "good" way around this because query strings in general DO NOT like quotes, but as you are POSTING the data, you could try this:


var val = qc_val;  //set the query variable before building your string


var qstring = "select \* from tbl_module_qualification_credits where tbl_module_qualification_credits.qc_advanced_credits=" + val
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pigmentartsAuthor Commented:
can it be anything to do with a server setting as on another server the same line does not error the code. maybe some sort of compression for ajax calls?
0
Steve KrileCommented:
Actually, I lied.  There is a good way around this. You should not pass the query (If at all possible) but rather a variable that identifies which query you want to run, or which fields you want to query.  Then rely on you receiving page to put together and parse a valid query.  The less info you cram in to a post variable, the better.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.