我有一个ajax函数调用一个visualforce页面。响应返回带有html doctype的结果。我只想要数据。
$(document).ready(function() {
$.ajax({
type: "POST",
url: "/apex/HotStuckLeadReportAjaxPage",
data: { name: "John", location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
});
输出:
Data Saved:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
{"sEcho":0,"iTotalRecords":"2","iTotalDisplayRecords":"2","aaData":[["8","1","sdf","test","test"],["9","12","asdf","asdf","asdf"]]}</html>
答案 0 :(得分:4)
在HotStuckLeadReportAjaxPage页面中添加contentType
<apex:page contentType="application/json">
答案 1 :(得分:0)
在你的情况下你可以