javascript - AJAX request not sending validate() data -


i want receive validate function output in above php code. except ajax, things working. can me correct problem?

$(document).ready(function(){     $("#d").click(function(){         validate();     })      function validate() {          var x;         var text;         var y, senddata;          x = document.getelementbyid('t').value;         y = x.length;          if (isnan(x) || y < 10 || y > 10) {             document.getelementbyid('t').style.backgroundcolor = "red";         }         // start ajax in else case receive validate data         else {             $.ajax({                 url: 'json.php',                 type: "post",                 datatype:'json',                 data: ({ phone: x }),                 success: function(response){                     alert ("success !");                 },                 error: function(response){                     alert("fail!");                 }             });          }     } }); 

need make changes in config set flag cors calls ...

<httpprotocol>     <customheaders>         <!-- enable cross domain ajax calls -->         <remove name="access-control-allow-origin" />         <add name="access-control-allow-origin" value="*" />     </customheaders> </httpprotocol> 

also ajax work please change condition go in "else" part


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -