Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
50
rated 0 times [  52] [ 2]  / answers: 1 / hits: 67980  / 11 Years ago, mon, july 8, 2013, 12:00:00

I am trying to write a function that will call getproduct.php?id=xxx when clicked. I can get the innerHTML portion to appear, but how do I also call the php page that actually does the work?



var id = id;
document.getElementById(digital_download).innerHTML =
Downloading...Please be patient. The process can take a few minutes.;
url = getproduct.php?id=id;

More From » php

 Answers
35

You can do it with jQuery for example.



var id = 1;
$('#digital_download').html('Downloading...'); // Show Downloading...
// Do an ajax request
$.ajax({
url: getproduct.php?id=+id
}).done(function(data) { // data what is sent back by the php page
$('#digital_download').html(data); // display data
});

[#77141] Friday, July 5, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
frankiebobbyc

Total Points: 18
Total Questions: 85
Total Answers: 104

Location: Norway
Member since Wed, Jul 7, 2021
3 Years ago
;