I am trying to execute an entire PHP file via the onClick event of some link.
<a onClick="phpSubmit();" class="submitButton">Submit</a>
Makes a successful call to this jQuery function
function phpSubmit()
{
alert('submitting');
$.post("/submit.php");
alert('submitted');
}
Which fails to execute the PHP file "submit.php", in the same directory.
Any ideas?
I have tried $.ajax, $.get and "submit.php" as well as "/submit.php". I don't know why this isn't working, repost $.ajax stuff if you think I was doing something wrong.
EDIT:
It's always the little things, I mistyped a character when I imported the jQuery script which is why $.ajax was undefined.
The above method WORKS.