我需要URI编码形式的输入,也就是,然后用一束的隐藏的输入串行化并将其发送到一个PHP文件..是有可能以某种encodeURIComponent方法结合成此行?:jquery的序列化和encodeURIComponent方法
var landingCreate = $(this).serialize();
UPDATE:
这样做,例如:
var landingCreate = $(this).serialize()+"&enc="+encodeURIComponent($('input[name=\'longform\']').val());
并输入URL:
http://www.smashingmagazine.com/2008/10/13/pricing-tables-showcase-examples-and-best-practices/
进入文本框,返回的URL不变..不应该它将所有破折号和斜杠等转换为十六进制代码?
UPDATE
下面是完整的代码。
123
$(document).ready(function(){
$.ajaxSetup ({ cache: false });
$('#createTokenLanding').submit(function() {
var landingCreate = $('#createTokenLanding').serialize();
$.ajax({
url: 'action-create.php',
data: landingCreate,
success: function(responseText){
$('#result').html(responseText);
}
});
return false;
});
});
2010-11-25
Gary
+0
您想要传递URI编码的输入是由用户输入还是隐藏的输入? –
2010-11-25 14:22:38
+0
它由用户输入。 –
2010-11-25 14:23:56
+0
“longform”的形式是“this”?你正在使用事件提交来发送Ajax数据? –
2010-11-25 15:06:59