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?    

            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

LVL 12
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Steve KrileConnect With a Mentor Commented:
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
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?
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.
All Courses

From novice to tech pro — start learning today.