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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
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
0
 
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
All Courses

From novice to tech pro — start learning today.