I am hoping someone can help me with this. I have only just started using AJAX and I am having an issue with the URL. The user selects an option from a multiselect dropdown list. When they press save, the data is posted to the Ajax below.
$("#getSelected").click(function (e) {
e.preventDefault();
var myList = $('select#my-select').val();
var list_new = "[" +myList+ "]"
var parseList = JSON.parse(list_new);
var ajaxResponse = $.ajax({
type: 'POST',
url: "/mysite/my-account/updatefavourite.cfm?q=1&buster='+new Date().getTime();",
contentType: "application/json; charset=utf-8",
cache: false,
data: JSON.stringify( parseList ),
success: function() {
$("#successMessage").show();
}
})
alert("test");
location.reload();
});
In Chrome and firefox this works fine without the alert. In IE, if I include the alert("test") then everything works fine. the data is posted to my page, it updates the database, reloads the page and updates the display list. Once I remove the alert, the url no longer works and the data is not sent to my page. Can someone help. Why in IE it works with the alert but not without it and how I can I get it to work without the alert.