javascript - redirect page using ajax & jquery (php) -
i want redirect page page profile , in between there post session on them. in case let's info variable $name
in string. far code on page
jquery("#result").on("click",function(e){ var $clicked = $(e.target); var $name = $clicked.find('.name').html(); var decoded = $("<div/>").html($name).text(); $('#searchid').val(decoded); //the ajax script $.ajax({ type: 'post', url: 'b.php', data: 'result='+$name, success: function() { window.location.href = "profile.php"; // replace } }); });
and on page b
code is:
<?php echo $_post['result']?>
the outcome should value result
in determined on page a
. there error message saying unidentified index
. doing wrong?
could be, info parameter wrong? have ajax calls folowing:
jquery.ajax({ type: "post", url: "b.php", data: { result: $name }, success: function() { window.location.href = "profile.php"; // replace } });
javascript php jquery ajax
No comments:
Post a Comment