我不知道我的数据语法是否错误,但是当没有传递参数时这个相同的脚本正在工作,但是当传递参数时,它就不起作用了。为什么?
<script type="text/javascript" src="jquery-1.7.2.min.js">
<script type="text/javascript">
function GetAge() {
var StrYear = document.getElementById("StringYear").value;
var StrMonth = document.getElementById("StringMonth").value;
var StrDay = document.getElementById("StringDay").value;
jQuery.support.cors = true;
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
jsonp: 'jsonp_callback',
async: false,
url: 'http://localhost:50113/Service1.asmx/GetAge',
data: "{ StrYear: "+StrYear+", StrMonth:"+ StrMonth+" , StrDay: "+StrDay+" }",
success: function (msg) {
$('#divToBeWorkedOn').html(msg.d);
},
error: function (e) {
$('#divToBeWorkedOn').html("Unavailable");
}
});
}
</script>