0

How to execute php function through ajax and then return the answer from php?

I decided to create a blog where the admin posts all sorts of different news. Each news item has a number of likes and views and when I click on the like button it is placed, but the page is completely reloaded. Most recently, I learned that using ajax can execute php script without refreshing the page. And I have a question, "how?". I dug through the entire Internet, but not found the answer or if found, then simply not understood. Could anyone who knows how to write me the example code and that php is returned and displayed on the data page after the script execution type: <?php if($like=='1'){ echo ' Like delivered!'; }else{ echo 'an error Occurred!'; } ?>

25th Apr 2018, 1:53 PM
Salakhov Almas
Salakhov Almas - avatar
2 ответов
25th Apr 2018, 3:07 PM
kaliki chandu
kaliki chandu - avatar
0
@kaliki chandu Thank you
25th Apr 2018, 3:52 PM
Salakhov Almas
Salakhov Almas - avatar