Robert Treadwell
asked on
Ajax, Success: returning msg or data to the success function
I have a jquery ui dialog box containing a iframe. When user presses the Submit button I want to process user entry and depending on the entry either close dialog and return to parent page, or redirect iframe to another iframe.
My questions:
1. Can to send data back to the success parameter? ie. success: function(data) {
2. If yes, then how.
3. If no, is there a way of redirecting the contents in dialog ui without closing and reopening.
See Code below:
jquery:
$.ajax({ type: 'POST',
url: ajaxUrl,
data: '{divName:"' + divName + '", signInID:"' + signInID + '", signInOutType:"In", orgID:' + orgID + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if (data.?) {
//How do I do this properly?
}
},
error: function (jqXHR, error, errorThrown) {
if (jqXHR.status && jqXHR.status == 400) {
alert(jqXHR.responseText);
} else {
alert("Error! Try again...");
}
}
});
vb.net
'Get SignInType
Dim sitQuery = (From sit In oDB.OrgSignInTypes Where sit.orgID = orgID And sit.fieldValue = "Alpha-Numeric Entry" And sit.selectFlag = "True" _
Or sit.fieldValue = "Numeric Only Entry" And sit.selectFlag = "True"
Select sit).SingleOrDefault
If (sitQuery Is Nothing) Then
Return False
Exit Function
End If
'Redirect iframe based on Query_FieldValue
If sitQuery.fieldValue = "Alpha-Numeric Entry" Then
'Send data back to jqueryUI to redirect to Alpha-Numeric page
ElseIf sitQuery.fieldValue = "Numeric Only Entry" Then
'Send data back to jqueryUI to redirect to Numeric page
End If
My questions:
1. Can to send data back to the success parameter? ie. success: function(data) {
2. If yes, then how.
3. If no, is there a way of redirecting the contents in dialog ui without closing and reopening.
See Code below:
jquery:
$.ajax({ type: 'POST',
url: ajaxUrl,
data: '{divName:"' + divName + '", signInID:"' + signInID + '", signInOutType:"In", orgID:' + orgID + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if (data.?) {
//How do I do this properly?
}
},
error: function (jqXHR, error, errorThrown) {
if (jqXHR.status && jqXHR.status == 400) {
alert(jqXHR.responseText);
} else {
alert("Error! Try again...");
}
}
});
vb.net
'Get SignInType
Dim sitQuery = (From sit In oDB.OrgSignInTypes Where sit.orgID = orgID And sit.fieldValue = "Alpha-Numeric Entry" And sit.selectFlag = "True" _
Or sit.fieldValue = "Numeric Only Entry" And sit.selectFlag = "True"
Select sit).SingleOrDefault
If (sitQuery Is Nothing) Then
Return False
Exit Function
End If
'Redirect iframe based on Query_FieldValue
If sitQuery.fieldValue = "Alpha-Numeric Entry" Then
'Send data back to jqueryUI to redirect to Alpha-Numeric page
ElseIf sitQuery.fieldValue = "Numeric Only Entry" Then
'Send data back to jqueryUI to redirect to Numeric page
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.