Hi, I'm implementing a form that after enter 2 or 3 values (values of Session Vars) should load an aspx on the same div. The problem I've is that when tries to load the aspx on the div nothing happens. On Firefox appear the aspx for a second to dissapear
and on Chrome the screen appears in blank and when this happens on the tab appears: "Connecting", but nothing happens.
If I use the developer tools of Chrome I can arrive to find this error message:
Uncaught TypeError: Cannot read property 'onsubmit' of null
I've been searching for it but I haven't been able to find why happens. Could someone explain me why appears this message and why I can't see my aspx?
Thanks in advance!
Jquery and CodeBehind of the form to call to the second site, this works fine:
JAVASCRIPT
$("#btnSubmitLogin").click(function() {
//var stringError = "";
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "LoginRegletaWeb.aspx/CrearVarsSession",
data: "{ LOGINCTI: '" + $("#tbLogin").val() + "', EXTENSIONCTI: '" + $("#tbExtension").val() + "', TELFREMOTOCTI: '" + $("#tbTelf").val() + "'}",
dataType: "json",
success: function(data) {
if (data.d == "1") {
alert("Debes introducir el login y la extensión.");
}
else if ((data.d == "RegletaWeb.aspx")||(data.d == "RegletaWebRemoto.aspx")) {
$("#tbLoginRegletaWeb").load(data.d);
}
else {
alert("Error: " + data.d);
}
},
error: function(xhr, textStatus, errorThrown) {
alert("textStatus: " + textStatus.toString() + " ErrorThrown: " + errorThrown.toString());
}
});
});
CODEBEHIND
<WebMethod()> _
Public Shared Function CrearVarsSession(ByVal LOGINCTI As String, ByVal EXTENSIONCTI As String, ByVal TELFREMOTOCTI As String) As String
Dim devolver As String = ""
Try
If Trim(LOGINCTI) <> "" And Trim(EXTENSIONCTI) <> "" Then
HttpContext.Current.Session("MST_LOGINCTI") = LOGINCTI
HttpContext.Current.Session("MST_EXTENSIONCTI") = EXTENSIONCTI
devolver = "RegletaWeb.aspx"
Else
Return "1"
End If
If Trim(TELFREMOTOCTI) <> "" Then
HttpContext.Current.Session("MST_TELFREMOTOCTI") = TELFREMOTOCTI
'devolver = "RegletaWebRemoto.aspx"
End If
Return devolver
Catch ex As Exception
Return ex.ToString()
End Try
End Function
Ever than a programmer makes an extra hour god kills a kitten
kilofafeure
Participant
1507 Points
753 Posts
Uncaught TypeError: Cannot read property 'onsubmit' of null
Jun 15, 2012 12:36 PM|LINK
Hi, I'm implementing a form that after enter 2 or 3 values (values of Session Vars) should load an aspx on the same div. The problem I've is that when tries to load the aspx on the div nothing happens. On Firefox appear the aspx for a second to dissapear and on Chrome the screen appears in blank and when this happens on the tab appears: "Connecting", but nothing happens.
If I use the developer tools of Chrome I can arrive to find this error message:
I've been searching for it but I haven't been able to find why happens. Could someone explain me why appears this message and why I can't see my aspx?
Thanks in advance!
Jquery and CodeBehind of the form to call to the second site, this works fine:
JAVASCRIPT $("#btnSubmitLogin").click(function() { //var stringError = ""; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "LoginRegletaWeb.aspx/CrearVarsSession", data: "{ LOGINCTI: '" + $("#tbLogin").val() + "', EXTENSIONCTI: '" + $("#tbExtension").val() + "', TELFREMOTOCTI: '" + $("#tbTelf").val() + "'}", dataType: "json", success: function(data) { if (data.d == "1") { alert("Debes introducir el login y la extensión."); } else if ((data.d == "RegletaWeb.aspx")||(data.d == "RegletaWebRemoto.aspx")) { $("#tbLoginRegletaWeb").load(data.d); } else { alert("Error: " + data.d); } }, error: function(xhr, textStatus, errorThrown) { alert("textStatus: " + textStatus.toString() + " ErrorThrown: " + errorThrown.toString()); } }); }); CODEBEHIND <WebMethod()> _ Public Shared Function CrearVarsSession(ByVal LOGINCTI As String, ByVal EXTENSIONCTI As String, ByVal TELFREMOTOCTI As String) As String Dim devolver As String = "" Try If Trim(LOGINCTI) <> "" And Trim(EXTENSIONCTI) <> "" Then HttpContext.Current.Session("MST_LOGINCTI") = LOGINCTI HttpContext.Current.Session("MST_EXTENSIONCTI") = EXTENSIONCTI devolver = "RegletaWeb.aspx" Else Return "1" End If If Trim(TELFREMOTOCTI) <> "" Then HttpContext.Current.Session("MST_TELFREMOTOCTI") = TELFREMOTOCTI 'devolver = "RegletaWebRemoto.aspx" End If Return devolver Catch ex As Exception Return ex.ToString() End Try End Functionmaitreya
Member
4 Points
2 Posts
Re: Uncaught TypeError: Cannot read property 'onsubmit' of null
Nov 02, 2012 07:05 AM|LINK
Hi,
I am facing a similer issue. Have you got any solution for this. Please post it here.
anil.india
Contributor
2613 Points
453 Posts
Re: Uncaught TypeError: Cannot read property 'onsubmit' of null
Nov 02, 2012 07:13 AM|LINK
Are you using updatepanel?
codepattern.net/blog ||@AnilAwadh
kilofafeure
Participant
1507 Points
753 Posts
Re: Uncaught TypeError: Cannot read property 'onsubmit' of null
Nov 02, 2012 08:48 AM|LINK
I didn't find any answer and without help I wasn't able to solve the problem...I'm sorry
maitreya
Member
4 Points
2 Posts
Re: Uncaught TypeError: Cannot read property 'onsubmit' of null
Nov 04, 2012 04:57 PM|LINK
No, I am not using updatepanel