• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 472
  • Last Modified:

jQuery POST data to PHP

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
Serellyn
Asked:
Serellyn
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
You only need to send artistname as parameter :

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

Open in new window

0
 
SerellynAuthor Commented:
You did it, once again. Thank you my friend
0
 
leakim971PluritechnicianCommented:
You're very welcome! Thanks for the points!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now