﻿
{"id":2563,"date":"2014-03-14T21:10:58","date_gmt":"2014-03-14T21:10:58","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=2563"},"modified":"2014-03-14T21:13:55","modified_gmt":"2014-03-14T21:13:55","slug":"jquery-when-then-kontrolu","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/jquery-when-then-kontrolu\/","title":{"rendered":"JQuery &#8211; when then Kontrol\u00fc"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>JQuery ile Ajax istekleri sonu\u00e7lar\u0131n\u0131n do\u011fru d\u00f6n\u00fcp d\u00f6nmedi\u011fini when then kontrol\u00fc ile kontrol edebiliriz.<br \/>\nA\u015fa\u011f\u0131daki prototipi inceleyiniz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n$.when(---Ajax \u0130ste\u011fi---).then(---birinci parametre---, ---ikinci parametre---);\r\n<\/pre>\n<p>G\u00f6rd\u00fc\u011f\u00fcn\u00fcz gibi Ajax iste\u011fini when blo\u011funda kontrol ettikten sonra then blo\u011funda iki parametre al\u0131nmaktad\u0131r.E\u011fer Ajax iste\u011fi do\u011fruysa birinci, yanl\u0131\u015f ise ikinci parametre alan\u0131 devreye girecektir.<br \/>\nA\u015fa\u011f\u0131daki \u00f6rne\u011fi inceleyiniz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;script type=&quot;text\/javascript&quot; src=&quot;js\/jquery-2.0.2.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n$.when($.ajax(&quot;harici.html&quot;)).then(dogru,yanlis);\r\nfunction dogru()\r\n{\r\n\talert(&quot;Do\u011fru i\u015flem yap\u0131ld\u0131.&quot;);\r\n}\r\nfunction yanlis()\r\n{\r\n\talert(&quot;Yanl\u0131\u015f i\u015flem yap\u0131ld\u0131.&quot;);\r\n}\r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Yukar\u0131daki kod blo\u011funu incelerseniz e\u011fer &#8220;$.ajax(&#8220;harici.html&#8221;)&#8221; komutuyla &#8220;harici.html&#8221; isimli dosya Ajax ile talep ediliyor.E\u011fer b\u00f6yle bir dosya sonu\u00e7 verirse &#8220;dogru&#8221; fonksiyonu \u00e7al\u0131\u015facakt\u0131r.Aksi taktirde &#8220;yanlis&#8221; fonksiyonu devreye girecektir.<\/p>\n<p>\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>JQuery ile Ajax istekleri sonu\u00e7lar\u0131n\u0131n do\u011fru d\u00f6n\u00fcp d\u00f6nmedi\u011fini when then kontrol\u00fc ile kontrol edebiliriz. A\u015fa\u011f\u0131daki prototipi inceleyiniz. $.when(&#8212;Ajax \u0130ste\u011fi&#8212;).then(&#8212;birinci parametre&#8212;, &#8212;ikinci parametre&#8212;); G\u00f6rd\u00fc\u011f\u00fcn\u00fcz gibi Ajax iste\u011fini when blo\u011funda kontrol ettikten sonra then blo\u011funda iki&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,19],"tags":[748,573,95,574],"class_list":["post-2563","post","type-post","status-publish","format-standard","hentry","category-ajax","category-jquery","tag-jquery","tag-then","tag-when","tag-when-then"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/2563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=2563"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/2563\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=2563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=2563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=2563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}