http://forum.wmonlin...howtopic=116461
Peguei o codigo:
<script language="javascript"> function pesquisar_dados( valor ) { http.open("GET", "[color="#FF0000"]consultar.php[/color]?id=" + valor, true); http.onreadystatechange = handleHttpResponse; http.send(null); } function handleHttpResponse() { campo_select = document.forms[0].subcategoria; if (http.readyState == 4) { campo_select.options.length = 0; results = http.responseText.split(","); for( i = 0; i < results.length; i++ ) { string = results[i].split( "|" ); campo_select.options[i] = new Option( string[0], string[1] ); } } } function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var http = getHTTPObject(); </script>
a pagina consultar.php vai me mostrar com o echo 1 ou 2
Entao queria por um if la no ajax para que se for 1 mostra o alert e se for 2 nao mostra nada/nao faz nada...
acho que seria la no function handleHttpResponse()