Ajax related problems.
-
Good day!
Firstly, I really need your help guys as I’m really stuck for weeks trying to learn Ajax and Javascript. My case is this.
I am making “Add to favorite” feature. The problem is I want the link to be ajax. So when someone clicks the link “Add to favorite” it then changes to “Remove this favorite”. Then do execute the PHP functions without loading the page.
Here is my outline of my functions:
ajaxlink() {
if (isset($_REQUEST[‘watchlist’])) {
if ($_REQUEST[‘favorites’] == ‘add’) {
echo ‘Added’;
addtofavorites($_REQUEST[‘id’]);
} elseif ($_REQUEST[‘favorites’] == ‘remove’) {
echo ‘Removed’;
removethisfavorites($_REQUEST[‘id’]);
}
}
}addtofavorites();
removethisfavorites();Truly, need your help guys.
God Bless!
The topic ‘Ajax related problems.’ is closed to new replies.