php - $.Post doesn't work in Intel XDK -
i've basic code in xdk. app 1 button , code button :
$.post("http://url/test.php", {test:'1'}, function(res){ alert(res); } );
for testing purpose, i've php code in godaddy server.
the php code :
<?php if (isset($_post['test'])){ if ($_post['test'] = '1') echo "aok"; else echo "nok1"; } else echo "nok2";
when run 'emulate' in xdk , press button, getting
nok2
as output.
what going wrong or missing ?
update
the same code how-ever works get, , output
aok
php code :
<?php if (isset($_get['test'])){ // echo var_dump($_get) ; if ($_get['test'] = '1') echo "aok"; else echo "nok1"; } else{ //echo var_dump($_post) ; echo "nok2"; }
jquery:
$.ajax({ type: "get", url: 'http://url/test.php', data:{test:'1'}, success: function(res){alert(res);}, error:function(res){alert(res);}, datatype: 'text' });
replacing post causes problem.
you have bug in code fix , check if work. verified post request work intel xdk. in following line have mistake.
if ($_post['test'] = '1')
in case not figure out here supposed be.
if ($_post['test'] == '1')
Comments
Post a Comment