I have this script
var htm = function (){return $('#home_page_frame').html().trim()};
var data = {
type: "POST",
url: "save_changes.php",
data: "par="+ htm(),
success: function(msg){
alert('OK')
}
};
$.ajax(data);
Save_changes.php
echo $开发者_开发知识库_POST;
The problem is that if htm() is = to 'Save & Exit' or 'Save & Exit'
it returns only the Save and (i think it may be using the & as a new post parameter
I have tried encoding decoding, it's doing my heading SOS pls.
Let jQuery encode the data by passing in an object, like this:
data: { par: htm() },
This way that & gets encoded to a %26 like this: Save%20%26%20Exit. What using an oject is really doing under the covers is calling encodeURIComponent(), like this:
data: "par="+encodeURIComponent(htm())
加载中,请稍侯......
精彩评论