Solved

jQuery POST data to PHP

Posted on 2010-08-15
3
462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
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)
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

628 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