Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

wordpress and $.post()

Featured Replies

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 by pilgrim_fgau

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.

  • 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.

  • 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 by pilgrim_fgau

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.