开发者

How to return the original string in Java after using jquery.serialize()

I have a problem after serializing the form with jquery. Why some text retain the html entities even after loaded to Java(Servlet) For example I have a text & and it will return into %26 in Java.

I serialize and su开发者_如何学编程bmit the form into Java using this..

function ajaxSubmit(frmN){
    var serForm = $(frmN).serialize();

    $.ajax({
        type:'POST',
        url:'inser',
        data:{actionName : "insertField", formField : serForm},
        success: function(request){
            $("#reqContainer").html(request);
        }
    });

}

Is there a way to deserialize the html entities from java. I guess I need first to split the & and then split the = to get the list of field and its value, and after that the deserialization will begin.

I'll appreciate any help. I read some article using JSON but I don't have time to study it. If there is an alternative way submitting all the form values via ajax with jquery, and will get the original value from Java please let me know.


Did you try JQuery form plugin? I remember a ajaxSubmit utility method.

http://malsup.com/jquery/form/

Otherwise you could just use URLDecoder in java. This will change your ascii character back to its original string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜