ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 语法 ``` jQuery.get( url [, data ] [, success(data, textStatus, jqXHR) ] [, dataType ] ) 参数说明: dataType 从服务器返回的预期的数据类型。默认:智能猜测(xml, json, script, 或 html)。 ``` ### jqXHR 对象可使用 Promise ``` var jqxhr = $.get("example.php", function() { alert("success"); }) .success(function() { alert("second success"); }) .error(function() { alert("error"); }) .complete(function() { alert("complete"); }); // code // Set another completion function for the request above jqxhr.complete(function(){ alert("second complete"); }); ``` ## 示例 ### hello world ``` var data={ tags: "mount rainier", tagmode: "any", format: "json" }, $.get('ajax/test.html',data, function(data) { $('.result').html(data); alert('Load was performed.'); }); ```