JQuery will not set a higher scoped object in callback
- by user344666
Hello,
I have a jquery callback function. In that function I want it to change the value of a varible that is in a higher scope, for somereason it is not doing that. Here is the code.
Thanks
function add() {
var returnedData = {
my_id: 0
};
$.post("add_event.php", { event : toSendText }, function(data) {returnedData.my_id = 5;}, "json");
if(add_page == true){
alert(returnedData.my_id);
window.open('content-list.php?cal_id=');
}
}