Ajax toggle status
Posted on 2014-01-24
I've a page bookmark system in my site using the old coding style. Means that a user clicks on the bookmark button and the database updates with a page refresh. When the user is redirecting back instead of bookmark he is seeing the remove bookmark link. So far so good. At least works.
Now I want to have this feature using Ajax (no page refresh). When the user clicks the Bookmark link an Ajax request to be send to database and the link to change to "Remove bookmark". Clicking it new database update, new bookmark link update and so on.
How I can do it?