Find Jobs
Hire Freelancers

AJAX Query Post fileds

$10-30 USD

Completed
Posted about 9 years ago

$10-30 USD

Paid on delivery
I have the following code to produce a button with a unique ID of the related Wordpress post (there are several of these links); <div id="<?php echo $post->ID ;?>" class="button buy">Buy Now</div> When clicked, this needs to run an external PHP file and run a query based on the post id of the link. Ideally, something like this; <?php $post = get_post($post->ID);?> <a href="<?php the_field('itunes_link') ;?>">Buy Now</a> <?php wp_reset_query() ;?> I need someone to write the AJAX function to get the $post->ID of the clicked button, store as variable and use that to run the query. The returning data will be used within a popup. I had attempted this myself, but getting the $post->ID as a variable is something I do not know how to do! Here's my existing AJAX; jQuery(".buy").on('click', function(){ [login to view URL]({ url: '<?php echo get_stylesheet_directory_uri(); ?>/ajax/[login to view URL]', success: function (data) { [login to view URL]("popup").innerHTML = data; }, error: function (xhr, status, error) { if ([login to view URL] > 0) [login to view URL]("popup").innerHTML = ('Error: ' + status); } }); }); I hope that makes sense. Please ask if you have any questions.
Project ID: 7195398

About the project

5 proposals
Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hi. let's do it right now. The id is easy to get in the ajax. I will show you how to do it. . . I'll fix it in 10 minutes
$15 USD in 1 day
5.0 (1 review)
0.4
0.4
5 freelancers are bidding on average $25 USD for this job
User Avatar
A proposal has not yet been provided
$30 USD in 1 day
4.9 (3 reviews)
3.4
3.4
User Avatar
Hello I can help you to get it done quickly. I have 10+ years experience in php/mysql development. Thanks Guru Venkat
$25 USD in 1 day
4.8 (1 review)
1.0
1.0
User Avatar
A proposal has not yet been provided
$25 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of THAILAND
Witney, Thailand
5.0
31
Payment method verified
Member since Sep 10, 2013

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.