i trying post form through ajax jquery. php script points returns json encoded array. but, @ receiving end on main page json.parse()
not working.
please suggest if missing on file types need included
here code.
< script type = "text/javascript" > $(document).ready(function() { $("#send").submit(function() { //$("#submit_form").html(''); $("#modal-text2").html("<img src=" + "img/loader1.gif " + "/></br</br><h4>data validation in process !!! please wait</h4>"); $("#mymodal2").modal('show'); $.post($("#send").attr("action"), $("#send").serialize(), function(data) { var decode = json.parse(data); if (decode.err > 0) { alert("hi"); } }); //important. stop normal post return false; }); }); < /script>
the json encoded array being sent php script is:
{"err":8,"er1":1,"er3":1,"er4":1,"er5":1,"er6":1,"er7":1,"er8":1,"er9":1,"error1":"first name required","error3":"last name required","error4":"email required","error5":"please select gender","error6":"date of birth required","error7":"mobile no required","error8":"password required","error9":"please fill captcha"}
don't know if cause of hte problem or if typo in here, have typo in following line:
<img src="+"img/loader1.gif "+"/></br</br>
you aren't closing first linebreak, , slash should come after br - not sure why have many quuotes in html block - should :
$("#modal-text2").html("<img src='img/loader1.gif'/><br/><br/><h4>data validation in process !!! please wait</h4>")
Comments
Post a Comment