Jump to content

Jquery ajax

Craig Hopson

Recommended Posts

hi can some one explain to me what is going on with this code please index.php

<!DOCTYPE html><script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script><script>var data = 'something-here';$.ajax({    type: 'POST',    url: 'post.php',    data: data});</script>


<?phpob_start();var_dump($_POST);$data = ob_get_clean();$fp = fopen("textfile.txt", "w");fwrite($fp, $data);fclose($fp);?>


array(0) {}

why is the $_POST variable empty? and how would i post 2 variables like $_POST['firstname'] and $_POST['lastname']

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...