INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How do i process serialized data with Javascript and ASP?

How do i process serialized data with Javascript and ASP?

How do i process serialized data with Javascript and ASP?

(OP)
Im not sure if this is the right forum, but here it goes.

Im using ajax code to submit serialized data to my server side webpage:

$(document).on('pageinit', '#login', function() {
$(document).on('click', '#submit', function() { // catch the form's submit event
if($('#fname').val().length > 0 && $('#pfpass').val().length > 0){
// Send data to server through the ajax call
// action is functionality we want to call and outputJSON is our data
$.ajax({url: 'logmein.asp',
data: {action : 'login', formData : $('#check-user').serialize()},
type: 'post',
async: 'true',
dataType: 'json',
//contentType: 'application/json',
beforeSend: function() {
// This callback function will trigger before data is sent
$.mobile.showPageLoadingMsg(true); // This will show ajax spinner

},
complete: function() {
// This callback function will trigger on data sent/received complete
$.mobile.hidePageLoadingMsg(); // This will hide ajax spinner
},
success: function (result) {
alert(result.foo);
if(result.status=="true") {
alert('Logon successful');
$.mobile.changePage("#second");
} else {
alert('Logon unsuccessful!');
}
},
error: function (request,error) {
// This callback function will trigger on unsuccessful action
alert('Network error has occurred please try again!');
alert(request.responseText);

}
});
} else {
alert('Please fill all necessary fields');
}
return false; // cancel original event to prevent form submitting*/
});
});

on my server side web page I don't know how to access the form values.

If I do a Request.Form() I get: Action=login&formData=fname%3Dfoo%26pfpass%3Dbar
If I do a Request.Form('formData') I get: formData=fname%3Dfoo%26pfpass%3Dbar

I'm not sure how to access the values. I suppose it needs to be deserialzed but I can't figure out how with javascript and ASP.
Does anyone have an example of this?

Thanks!

RE: How do i process serialized data with Javascript and ASP?

Your string does not look serialized, merely url encoded. If you decode it you get:

formData=fname=foo&pfpass=bar


This is unrelated to Ajax, as decoding it would be done at the server by ASP.

You'll likely get more specific answers in forum333: Microsoft: ASP (Active Server Pages) or forum855: Microsoft: ASP.NET




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close