0

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?

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

can you help me to make the echo work... that I can see that messages
1

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);
});

Comments

0

You should process response from up.php in success function. Something like $(body).html(arguments[0])

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.