jquery - Sending Variable value using ajax for php -
i'm using $.ajax
call send data php page:
$.ajax({ type: 'post', url: "ajax_more.php", data: "userid=1" });
in ajax_more.php
i'm trying read value of userid:
$user_id=$_post['userid'] ;
however, i'm getting error php doesn't find value index userid.
what doing wrong?
update
i'm sending ajax variable in same manner:
$.ajax({ type: "post", url: "ajax_more.php", data: "lastmsg="+ id, cache: false, success: function(html){ $("div#listednotes").append(html); $("#more"+id).remove(); } });
and working fine, using <?php print_r( $_post ) ?>
, return value is: array ( [lastmsg] => 38 )
.
you might have used .htaccess redirection such removing or adding "www" web requests. change on affects post request parameters.
to solved, assure enter ajax url should according .htaccess rules.
Comments
Post a Comment