Guys,
I have this script in my site, and these script dont worked when I click in id to delete the record.
Follow the script, where is the error?
Tks,Code:<script type="text/javascript" src="ajax.js"></script> <script type="text/javascript"> function excluir(id) { // Instancia o objeto xmlhttp para a função excluir var httpExcluir = getHTTPObject(); // Envio pelo método GET e página que irá fazer a exclusão httpExcluir.open("GET", "delete.cfm?id="+id, true); // Função de retorno httpExcluir.onreadystatechange = function(){ if ( httpExcluir.readyState == 4 ) { if( httpExcluir.status == 200 ) { // Caso ocorra tudo corretamente a resposta virá aqui, // que é exatamente o output da pagina delete.cfm // alert(httpExcluir.responseText); } } } // Enviado httpExcluir.send(null); } </script> <form name="Ajax" method="GET"> <a href="javascript:excluir(#id#)">#nome#<br></a> </form> [/HTML] Ajax.js [HTML] function getHTTPObject() { var req; try { if (window.XMLHttpRequest) { req = new XMLHttpRequest(); if (req.readyState == null) { req.readyState = 1; req.addEventListener("load", function () { req.readyState = 4; if (typeof req.onReadyStateChange == "function") req.onReadyStateChange(); }, false); } return req; } if (window.ActiveXObject) { var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"]; for (var i = 0; i < prefixes.length; i++) { try { req = new ActiveXObject(prefixes[ i ] + ".XmlHttp"); return req; } catch (ex) {}; } } } catch (ex) {} alert("XmlHttp Objects not supported by client browser"); }
Fabiano Magno Pechibella



Reply With Quote
Bookmarks