If I post a Form and it goes to the next page(php,Sql) then another URL. How can I prevent a Ajax Result alert on the post page as the page has changed and moved on? Should I just hide the result div or can I remove the function data?
$(document).ready(function(){
//set var to bid number input field
$("#favourites").click(function(event){
event.preventDefault();
//set var to bid number input field
var content= $("#bidnumber").val();
// Url to post to and Field name and content */
$.post('add_favourites.php', {bidnumber:content},
// Alert Success
function(data){
// Alerts the results to this Div
$("#favourites").html(data);
});
});
});
The callback function(data) { ... }
is optional. You can remove it.