mercredi 25 février 2015

jQuery Double Escaping Ampersand

I am trying to figure out how to double escape POSTED form data that is sent to an XML API using ajax. Here is the on form submit ajax function.



$.validator.setDefaults({
submitHandler: function() {
var $form = $("#signupForm");
$.ajax({
type: "POST",
url: "http://ift.tt/1LI4Rgi",
data: $("#signupForm").serialize(),
success: function() {
alert("Copy Completed");
}
});

}
});


The issue that I am having is that when it is processed by the vendor's api the human readable "&" truncates everything after it.


If I manually submit the form using "&", the API inserts the full string into the vendor's database. I need to convert "&" to "&" within all fields in the of the serialized string.


I was looking at this...but not quite sure where it need to be placed in the function above to submit the modify values.



var values = $("#signupForm").serialize();
values = value.replace("&", "&");


Thanks jlimited


Aucun commentaire:

Enregistrer un commentaire