I have a modal in index.php which when the button to load it is click I need to display the returned data from an ajax post to a PHP file that returns the subscriptions and if a user is subscribed to one it needs to have a unsubscribe button to the right, if the user is not subscribed it should have a subscribe button.
I cant figure out how to return all the subscriptions and display them in the modal from a ajax post. I know i need to send the data back from the php file in Json format, but I do not know how to get all of the subscriptions and if the user is subscribed all in json format
This is where the Ajax call has to happen
$(document).on('pagebeforeshow','#subscriptions', function(){
$.post("getsubs.php",function(data))
});
To further explain better it should look like this when the modal button is click
Subscription A ButtonToUnsubscribed(user is already subscribed)
Subscription B ButtonToUnsubscribed(user is already subscribed)
Subscription C ButtonToSubscribe(Not subscribed to this one)