ajax get post urlEncode url和body

		$("#ajaxPostZh").click(function() {
				var merchantVal = {
					id : 1234567,
					name : "喵喵",
					alias:":meowmeow%",
					content:encodeURIComponent("aa%cc haha ​​bbb")
				};
				$ .qAjax ({
					url : "http://enterprise.qbao.com/mechant/enterprise/register4.html",
					data : merchantVal,
					success : function(data) {
					}
				});
		})
		$("#ajaxGetZh").click(function() {
				var merchantVal = {
					id : 1234567,
					name : "喵喵",
					alias:":meowmeow%",
					content:encodeURIComponent("aa%cc haha ​​bbb")
				};
				$ .qAjax ({
					url : "http://enterprise.qbao.com/mechant/enterprise/register4.html?"+"v="+encodeURIComponent("aa%cc哈哈bbb"),
					type : "get",
					data : merchantVal,
					success : function(data) {
					}
				});
		})

 

Ajax post or get, key-value pair will be automatically urlEncode



 

=====================

 

 

 ==================

URL is different

If the ajax URL directly appears in Chinese, the Chinese will be urlEncoded, but the % will not be encoded

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326936272&siteId=291194637