Tuesday 15 July 2014

Trying to call PHP file using jQuery Ajax -


I am using jQuery 2.0.2 on Debian 7.0.0.

I'm trying to call a PHP script from Javascript file using JQuery.ajax. My code is as follows.

  jQuery.ajax ({type: "POST", url: "DisplayParameters.php", data: {LUT: lut, glow: glow, gamma: gamma, background: background}}) . (Function (result) {$ ("# msg"). Html ("called ajax");});   

At the beginning of DisplayParameters.php, I have the following.

 ? & Gt; & Lt; Script language = "javascript" & gt; Warning ('DisplayParameters'); & Lt; / Script & gt; & Lt ;? Php   

But the warning box is not called. Firebug shows income and DisplayParameters.php text (with a +/- control to collapse and extend) without any error. But the warning box is not called.

What would be the best way to get feedback for me (like the warning box or console.log) from DisplayParameters.php

The text, console as your AJAX call DisplayParameters.php , gives .log (the result) will show: < / P>

  & lt; Script language = "javascript" & gt; Warning ('DisplayParameters'); & Lt; / Script & gt;   

If you want to add this additional code to the page (which I do not recommend unless you are not sure that you will not break the current page), then you can try :

  jQuery.ajax ({type: "POST", url: "DisplayParameters.php", data: {LUT: lut, glow: glow, gamma: gamma, background: background}} ). Function (result) {$ ("# msg"). Html ("Ajax Called"); $ ("Body"). Attachment (result);});   

Another way to serialize (JSON) will be your required information, Type the data: Set the option "Jason" , and depending on this information Work.

If you send the HTML, make sure that your PHP code does not show any error or warning message.

No comments:

Post a Comment