javascript - Have a delete button, must be hit twice to update page in IE -
so have "delete record button" in other browser functioning correctly. deletes record sql, , updates page. thought ie not updating page js event, , deleting record view. if hit once, doesn't update page, twice does. hit once, , refresh page manually gone view properly. ever heard of ie doing this? nothing in debugger telling me of error. delete event below, if mishandled. ie need special filter handle events this? thanks!
// button in question creation function create_delete_button( oobj ) { return '<input type="button" value="delete" onclick="deleteitem(' + oobj.adata[0] + ')"/>';} // post db deletion function deleteitem( id ) { $.post( "/data/deleteitem?id=" + id, getupdateditems() );}
the code you've shown not update page in way in browser - doesn't include dom manipulation or navigation @ all. whole point of ajax (and assume $.post()
jquery ajax method) makes request without refreshing page.
so assume problem must getupdateditems()
function don't show, in way calling it. try removing parentheses after getupdateditems
, this:
$.post( "/data/deleteitem?id=" + id, getupdateditems ); // parentheses removed here ^
jquery's $.post()
method expects callback function second argument. is, supposed pass reference function , jquery call function after post completes.
what doing in code in question calling function , passing result $.post()
, means getupdateditems()
gets executed before post delete item. if getupdateditems()
ajax request can't guarantee timing of request comes first.
"nothing in debugger telling me of error."
the particular problem identified isn't javascript error, wouldn't reported in debugger. it's valid code, doesn't have effect want.
Comments
Post a Comment