Reputation: 558
have a question and I hope that you can help me with it. I have two file frame.js and up.php. frame.js take data from inputs (work correctly), and sent to up.php.
Frame.js
//some code
$.ajax({
type : "POST",
url: "up.php",
data: {
login: login;
pass: pass},
success : function() {
alert('success');
close_frame ();
}
});
up.php
<?php
echo('reg start'); //message to check that it work
echo ('<script>alert('reg start');</script>'); // another varient to check
if ((isset($_POST['login']))
//some code
?>
SO jquery sent information to up.php. But is up.php launch automatically or what I need to do to make the up.php to take the data from jquery file?
Upvotes: 0
Views: 39
Reputation: 600
You can access any variables you send through $_POST
in up.php.
You should know that jQuery has a built in function for POST ajax requests:
$.POST(url, data)
.done(function(response){
alert(response);
});
Upvotes: 1
Reputation: 725
The up.php will run and all the data send via the ajax will be receive in the
$_POST
So basically you do need to do anything to make the data available in the php because it's already available But notice that you are not doing anything with the response (the 2 echos) so you will have to open the firebug/console in order to see the prints
Upvotes: 1
Reputation: 139
You should process response from up.php in success function. Something like $(body).html(arguments[0])
Upvotes: 0