Reputation: 4773
I am using this jquery code
$("#tasksViewType").selectBox().change(
function (){
var userId = $('#hiddenUserId').val();
var viewTypeId = $("#tasksViewType").val();
$.post('updateViewType',{viewType:viewTypeId,userId:userId});
location.reload(true);
});
so this update the view type in database and then refresh the page but in firefox this is not working I tested in chrome and opera this is working fine.
I even tried to put the timer between the 3rd and 4th line but then it update the view type in database but not refresh the page autometically.
Please let me know if you need more detail.
Upvotes: 0
Views: 173
Reputation: 2476
A possible reason could be the Cross-origin resource sharing restriction. In firefox, by default, Cross-site HTTP requests are restricted. You need to enable enable cross-origin resource sharing explicitly.
You may refer to the following links for more details.
how to get a cross origin resource sharing cors post request working
Upvotes: 0
Reputation: 781058
Reload the page in the callback function. Otherwise, the page will reload before the server script has updated the database.
$.post('updateViewType',{viewType:viewTypeId,userId:userId}, function() {
location.reload(true);
});
Upvotes: 3
Reputation: 11984
Set the extension of your page in the post.Like if your page is php
type then give it like the following
$.post('updateViewType.php',{viewType:viewTypeId,userId:userId});
Upvotes: 0