Solved

jQuery POST data to PHP

Posted on 2010-08-15
3
457 Views
Last Modified: 2013-11-08
I've got this code, but it's not correct since the parameters I'm posting aren't correctly yet.

var artistname = $("input#artistname").val();
            
            jQuery.post('get-albums.php',
            {parameterSentToServer1:'value', param2:'value2'},

I need the parameters replaced by the var artistname, I just can't figure it out.

In the PHP file it needs to be catched by: $artistname = trim($_POST['artistname']);

Someone help please
0
Comment
Question by:Serellyn
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 33442537
You only need to send artistname as parameter :

jQuery.post('get-albums.php',
{"artistname":$("#artistname").val()},

Open in new window

0
 
LVL 1

Author Closing Comment

by:Serellyn
ID: 33442545
You did it, once again. Thank you my friend
0
 
LVL 82

Expert Comment

by:leakim971
ID: 33442551
You're very welcome! Thanks for the points!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now