Solved

jQuery POST data to PHP

Posted on 2010-08-15
3
456 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

759 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

23 Experts available now in Live!

Get 1:1 Help Now