Tuesday, 15 April 2014

jquery - php + Ajax + Json page submit -


I have a business functionality to do employee search (ajax) when submitting a form to me by using the jQuery-based Ajax employee Load details. The following is my search code. This issue is after submitting this form, and

is not populated with values ​​in employee. Php Page I was looking at json object, was able to print employees.

I think the form is gathering down, but Jason is not returning after becoming an object. Can someone help me how I can call it ajax based.

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; Script type = "text / javascript" src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {// alert ('test'); $ (".js-ajax-php-json"). Submit (function () {alert ('test'); $ .getJSON (Var i = 0; i & lt; jsonArray.length-1; i ++) {var emp = jsonArray [i] (for example, "employee .php", function (Jasoncentant) {alert (Jessentantant); JSNARRU = Jasoncentent; ]; $ ("#emp") .HTML (i + "+ emp [0] .lastname +" - "+ emp [0]. First name +" - ");}});});}); & Lt; / script & gt; & lt; / head & gt; & lt; body & gt; & lt; form class = "js-ajax-php-json" verb = "employee. Php "method =" GET "& gt; div class =" input-group ">      

  & script; script type =" text / javascript "> $ (document) .ready (function () {// alert ('test'); $ (".js-ajax-php-json ". Submit (function (e) {e.preventDefault (); // By submitting the form. $ .getJSON (" Employee .php ", Function (JasonCentent) {Warning (Jason Content); JSNER = JSONSangent; For (var i = 0; i & lt; jsonArray.length-1; i ++) {var emp = JsonArray [i]; $ ("# emp"). Html (i + "+ emp [0] .lastname + "-" + emp [0]. First name + "-");}});});}); & Lt; / Script & gt;  

You missed preventDefault () to stop the form from being stopped.


No comments:

Post a Comment