{"id":855,"date":"2017-02-27T08:59:46","date_gmt":"2017-02-27T00:59:46","guid":{"rendered":"http:\/\/www.iooe.cn\/?p=855"},"modified":"2017-02-27T08:59:46","modified_gmt":"2017-02-27T00:59:46","slug":"ajax%e9%93%be%e6%8e%a5%e6%89%a9%e5%b1%95-dwz%e7%9a%84%e5%b7%a5%e4%bd%9c%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"http:\/\/www.iooe.cn\/index.php\/2017\/02\/27\/ajax%e9%93%be%e6%8e%a5%e6%89%a9%e5%b1%95-dwz%e7%9a%84%e5%b7%a5%e4%bd%9c%e5%8e%9f%e7%90%86\/","title":{"rendered":"Ajax\u94fe\u63a5\u6269\u5c55 dwz\u7684\u5de5\u4f5c\u539f\u7406"},"content":{"rendered":"<h2>\n\tAjax\u94fe\u63a5\u6269\u5c55<br \/>\n<\/h2>\n<p>\n\t&lt;a href=&rdquo;xxx&rdquo; target=&ldquo;ajax&rdquo; [rel=&ldquo;boxId&rdquo;]&gt;\n<\/p>\n<p>\n\t\u793a\u4f8b: &lt;a href=&rdquo;w_alert.html&rdquo; target=&rdquo;ajax&rdquo; rel=&rdquo;container&rdquo;&gt;\u63d0\u793a\u7a97\u53e3&lt;\/a&gt;\n<\/p>\n<h2>\n\t<a name=\"t1\"><\/a>\u5f53\u524dnavTab\u4e2d\u94fe\u63a5ajax post\u6269\u5c55<br \/>\n<\/h2>\n<p>\n\t&lt;a href=&rdquo;user.do?method=remove&rdquo; target=&rdquo;<strong>ajaxTodo<\/strong>&ldquo;&gt;\u5220\u9664&lt;\/a&gt;\n<\/p>\n<p>\n\t\u6216\n<\/p>\n<p>\n\t&lt;a href=&rdquo;user.do?method=remove&rdquo; target=&rdquo;<strong>ajaxTodo<\/strong>&rdquo; title=&rdquo;\u786e\u5b9a\u8981\u5220\u9664\u5417?&rdquo;&gt;\u5220\u9664&lt;\/a&gt;<strong>\uff08\u7528\u6765\u505a\u8bd1\u8005\u65f6\u95f4\u5360\u7528\u64cd\u4f5c\uff09<\/strong>\n<\/p>\n<p>\n\t$(&ldquo;a[target=ajaxTodo]&ldquo;, $p).each(<strong>function<\/strong>(){<strong>\/\/each\u8fed\u4ee3,\u9009\u62e9a\u4e2d\u6709target=ajaxTodo\u7684<\/strong>\n<\/p>\n<p>\n\t$(<strong>this<\/strong>).click(<strong>function<\/strong>(event){<strong>\/\/\u5c06dom\u5bf9\u8c61\u8f6c\u6210jquery\u5bf9\u8c61$(this)<\/strong>\n<\/p>\n<p>\n\t<strong>var<\/strong>&nbsp;$this = $(<strong>this<\/strong>);\n<\/p>\n<p>\n\t<strong>var<\/strong>&nbsp;title =&nbsp;$this.attr(&ldquo;title&rdquo;)<strong>;\/\/\u83b7\u5f97jquery\u5bf9\u8c61\u7684title\u5c5e\u6027<\/strong>\n<\/p>\n<p>\n\t<strong>if<\/strong>&nbsp;(title) {\n<\/p>\n<p>\n\talertMsg.confirm(title, {\n<\/p>\n<p>\n\tokCall:&nbsp;<strong>function<\/strong>(){\n<\/p>\n<p>\n\tajaxTodo($this.attr(&ldquo;href&rdquo;));\n<\/p>\n<p>\n\t}\n<\/p>\n<p>\n\t});\n<\/p>\n<p>\n\t}&nbsp;<strong>else<\/strong>&nbsp;{\n<\/p>\n<p>\n\tajaxTodo($this.attr(&ldquo;href&rdquo;));\n<\/p>\n<p>\n\t}\n<\/p>\n<p>\n\tevent.preventDefault();&nbsp; \/\/\u53d6\u6d88\u4e8b\u4ef6\u9ed8\u8ba4\u884c\u4e3a\n<\/p>\n<p>\n\t});\n<\/p>\n<p>\n\t});\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\tTitle\u4e3a\u53ef\u9009\u9879\uff0c\u5982\u679c\u8bbe\u7f6e\uff0c\u70b9\u51fb\u540e\u5c06\u8c03\u7528alertMsg.confirm\u4e0e\u7528\u6237\u4ea4\u4e92\u786e\u8ba4\u6216\u53d6\u6d88\uff0cTitle\u503c\u4e3a\u63d0\u793a\u4fe1\u606f.Target\u503c\u4e3aajaxTodo\u65f6\u4f1a\u81ea\u52a8\u5173\u8054\u5982\u4e0bJS\u3002\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t<strong>function ajaxTodo(url, callback){<br \/>\n\t&nbsp;&nbsp; &nbsp;var $callback = callback || navTabAjaxDone;<br \/>\n\t&nbsp;&nbsp; &nbsp;if (! $.isFunction($callback)) $callback = eval(&#39;(&#39; + callback + &#39;)&#39;);<br \/>\n\t&nbsp;&nbsp; &nbsp;$.ajax({<br \/>\n\t&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;type:&#39;POST&#39;,<br \/>\n\t&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;url:url,<br \/>\n\t&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;dataType:&quot;json&quot;,<br \/>\n\t&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;cache: false,<br \/>\n\t&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;success: $callback,<br \/>\n\t&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;error: DWZ.ajaxError<br \/>\n\t&nbsp;&nbsp; &nbsp;});<br \/>\n\t}<\/strong>\n<\/p>\n<p>\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ajax\u94fe\u63a5\u6269\u5c55 &lt;a href=&rdquo;xxx&rdquo; target=&ldquo;ajax&rdquo; [rel=&ldquo;boxI&#8230; <\/p>\n<div class='button-mores'><a href='http:\/\/www.iooe.cn\/index.php\/2017\/02\/27\/ajax%e9%93%be%e6%8e%a5%e6%89%a9%e5%b1%95-dwz%e7%9a%84%e5%b7%a5%e4%bd%9c%e5%8e%9f%e7%90%86\/'> \u9605\u8bfb\u66f4\u591a&#8230; <\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/855"}],"collection":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/comments?post=855"}],"version-history":[{"count":1,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/855\/revisions"}],"predecessor-version":[{"id":856,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/855\/revisions\/856"}],"wp:attachment":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/media?parent=855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/categories?post=855"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/tags?post=855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}