Click on button, code behind the button executes but the page must not redirect to the stated web page.

I have a form. In this form , i have a button that when i click it, an image is displayed on a shop page. In addition, when the button is clicked , i am redirected to the shop page where i can see the image i uploaded being displayed. This is what i want to know how to do: i want to click the button and the code behind it must execute , but i dont want the page to be redirected. The reason i dont want it to be redirected is because the user might want to upload multiple products and it will irritating to click back on the web browser to enter another product. PS: im using php.

16th Feb 2018, 7:28 PM
Mogammad Shameer Losper
Mogammad Shameer Losper - avatar
1 Answer
You can use AJAX (Asynchronous JavaScript And XML), in JavaScript, for this exact purpose. Take a look at these, and let me know if I can assist you further: -> https://www.w3schools.com/xml/ajax_intro.asp If you're using jQuery, it provides much easier way to do so: -> http://api.jquery.com/jquery.ajax/
16th Feb 2018, 7:57 PM
dunfc - avatar