ajax - 3 clicks with a confirm javascript window? -
hi taking 3 clicks excute command javascript confirm prompt. code nested in handle-request ajax function. here code, dont know why doing this?
closebutton.onclick = function() { node.setdata('alpha', 0, 'end'); node.eachadjacency(function(adj) { adj.setdata('alpha', 0, 'end'); var requestone = createrequest(); var deletenode = node.id; var vars = "deletenode=" + encodeuricomponent(deletenode); requestone.open("post", "deletenode.php", true); requestone.setrequestheader("content-type", "application/x-www-form-urlencoded"); if (confirm('are sure want delete species database?')) { requestone.onreadystatechange = function() { handlerequest(requestone); }; requestone.send(vars); fd.fx.animate({ modes: ['node-property:alpha', 'edge-property:alpha'], duration: 500 }); } else { // nothing! } });
it doesn't mean that, required 3 clicks. have wait until operation complete. response. means readystate becomes 4.
readystate 1 of property of httprequest. indicates current state of object.
there 5 states.
0 - uninitialized (unsent)
1 - loading (opened)
2 - loaded (headers_received)
3 - interactive (loading)
4 - complete (done)
Comments
Post a Comment