Here is the PHP code in brief I’m working on,
$feed_url = "JASON Feed URL";
$json = file_get_contents($feed_url);
$products = json_decode($json);
foreach($products as $product){
$id = $product->id;
$name = $product->name;
$link = $product->link;
}
$query = INSERT INTO TABLE(id,name,link) VALUES ($id,$name,$link);
$result = mysqli_query($query);
I’m able to pull list of all products. Now, I want to add “selective products” to my database.
for example, I want to show “Install” button bellow each product and as I hit “Install”, the product details will add to my database and show “Pre-load animation image”. (I don’t want to use submit “form method” as it will refresh the search.)
I know this can be achieved using AJAX but I never learned AJAX 🙁 As I’ve to complete this project urgently no time to learn AJAX (definitely learn after finishing current work)
Somebody, please suggest basic function or steps to do this, I’ll find more information on my own to complete it. A little help will be appreciated.
I don’t condone giving full answers but I know what it’s like to be stuck 🙂
If you have the install button setup like this with a loading image underneath:
Where the id of a corresponds to the product id then you can make a jQuery function as follows:
You would then modify your PHP script to take the product id from the
$_GETsuperglobal and only insert that into the database: