javascript - jQuery error when defining object -


I have an Ajax form that calls a javascript function OnFailure . Here is a function that the user should show an error message in the div:

  function show error (ajaxcontontext) {var response = ajaxContext.responseText; Reaction = $ (reaction); Var itemVersion = response.filter ("div") [0] .innerHTML.trim () ToString (); Var error = response.filter ("p") [0] .outerHTML.toString (); $ ("#" + Item Warsons. Location (".", "") + "-instant installer results"). Blank (); $ (Error) .appendTo ("#" + Item Warsons. Location (".", "") + "-instanturable results"); }   

response = $ (response); , the code fails when an error occurs in the jQuery 1.9.1 file:

  Sizzle.error = function (msg) {new error ("Syntax error, unrecognized expression:" + Msg); }; Error: syntax error, unrecognized expression: & lt; P & gt; You have not entered a valid date & lt; / P & gt; & Lt; Div style = "display: none;" & Gt; V10.0 & lt; / Div & gt; & Lt; Div id = "v10.0" class = "error" & gt; & Lt; / Div & gt;   

The last time I checked it was working fine, but now it is error-prone and why I can not see any help will be great!

You should always trim the string when it is coming from the server and wrapped in a jQuery object. Because the server may return an invisible character at the beginning or end of the returned string, depending on return or file encoding (BOM?):

  feedback = $ ($ trim (feedback)) ;    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -