insomma, nel tuo codice manca sempre qualcosa![]()
ho provato così, con copia - incolla e mi funziona
codice:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="b.aspx.vb" Inherits="prove_b" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Pagina senza titolo</title> <script language="javascript" type="text/javascript"> // <!CDATA[ function Button1_onclick() { invia_dati(); } function crea_http_req() { var req = false; if (typeof XMLHttpRequest != "undefined") req = new XMLHttpRequest(); if (!req && typeof ActiveXObject != "undefined") { try { req=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { try { req=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { try { req=new ActiveXObject("Msxml2.XMLHTTP.4.0"); } catch (e3) { req=null; } } } } if(!req && window.createRequest) req = window.createRequest(); if (!req) alert("Il browser non supporta AJAX"); return req; } // invia i dati del form al server function invia_dati() { // l'oggetto per comunicare con il server var http_req = crea_http_req(); var dati_post = ""; http_req.onreadystatechange = gestisci_risposta; http_req.open('POST', "b.aspx?ajax_comando=1", true); http_req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); http_req.setRequestHeader("Content-length", dati_post.length); http_req.setRequestHeader("Connection", "close"); // forse il problema sta qui? http_req.send(dati_post); function gestisci_risposta() { if (http_req.readyState == 4) { if (http_req.status != 200) {alert("ERRORE NELLA TRASMISSIONE DATI!" + "\n\nreadyState:"+ http_req.readyState +"\nstatus: "+http_req.status + "\nstatusText: " + http_req.statusText + "\n\nheaders:\n"+ http_req.getAllResponseHeaders()); return;} var t = http_req.responseText; document.getElementById("div1").innerHTML = t; } } } // ]]> </script> </head> <body> <form id="form1" runat="server"> <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /> <div id="div1"></div> </form> </body> </html>

Rispondi quotando