I have a Web app (MVC 5), and when I move fast from index page to different page i get a javascript alert tell me : "The page at localhost:4332 says: " (its says nothing).
and when i press the OK button, evertything is back to normal its continue to the other page, i want to disable this alert from pop to the client.
I'm thinking its because i move to a different page too fast and the script cant run fully.
What i do in the script is initialize a drop down list with values i get from Ajax post request. (in order to save time from the load the page time, i load the page and than initialize the drop down list.
this is my code :
$(document).ready(function () {
$.ajax({
type: 'POST',
url: '/Home/GetProfiles',
success: function (data) {
$.each(data, function (key, value) {
$('#filterSelect').append($("<option></option>").attr("value", value).text(key));
});
},
error: function (ts) { alert(ts.responseText) }
});
})
I do a couple things more but i don't want to complicate the code that i posted here, i think the problem is related to this lines of code.
I try to add "try" and "catch" with console.log of the exception but i didn't get nothing to the console, and the alert keep pops
Any idea why its happens ? and how can i fix it ?