September 12, 201214 yr Anybody lend a helping hand to get this working? Ive basically got multiple forms and fields on a page, whereby on click of a submit button, I want to gather certain fields from multiple forms and use jquery's $.post() to post to a send mail php script. here is the code so far : $.post("submitMakeABookingPage.php", { name: "John", time: "2pm" }); at the minute the submitMakeABookingPage.php is just a php page to output hello world so I can see it being reached, but nothing happens I am wondering if it cannot find "submitMakeABookingPage.php" due to wordpress and its wonderful URL structure?! thanks in advance Edited September 12, 201214 yr by pilgrim_fgau
September 12, 201214 yr Why would anything happen? You're making an Ajax call to an essentially blank PHP page. AFAIK, the php page needs to return with something, then the jQuery can act on the response it gets. As it's post'ing to an empty page, it's essentially got nothing to response. This is AJAX, remember.
September 12, 201214 yr Author ive never used AJAX before in my life so im a bit of a noob. Ive changed the php page to : <? header('Location: http://www.google.com/');?> simply to see if it will request google.com, but still nothing.
September 12, 201214 yr Author so I can see in the console that it is appending the php page that I have requested to the end of the current URL e.g. http://localhost/lafontainedechocolat/make-a-booking/submitMakeABookingPage.php when I am wanting it to find ... http://localhost/lafontainedechocolat/submitMakeABookingPage.php ie in the root folder, any ideas how I can force it to look in the root folder? edit... I hard coded the "http://localhost/lafontainedechocolat/submitMakeABookingPage.php" URL for the AJAX request but still getting 404 ?! Edited September 12, 201214 yr by pilgrim_fgau
September 12, 201214 yr Author found out what the problem was... i forgot to put in the rest of the URL for the wordpress theme directory ie... $.post("/lafontainedechocolat/wp-content/themes/lafontainedechocolat/submitMakeABookingPage.php");
Create an account or sign in to comment