<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Techy Things &#187; jquery</title>
	<atom:link href="https://tech.yipp.ca/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>https://tech.yipp.ca</link>
	<description>Just another Yipp.ca Blogs site</description>
	<lastBuildDate>Thu, 01 May 2025 18:06:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>jQuery prevent uploading too large file in Frontend</title>
		<link>https://tech.yipp.ca/jquery/jquery-prevent-uploading-large-file-frontend/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-prevent-uploading-large-file-frontend</link>
		<comments>https://tech.yipp.ca/jquery/jquery-prevent-uploading-large-file-frontend/#comments</comments>
		<pubDate>Tue, 09 May 2017 21:39:17 +0000</pubDate>
		<dc:creator><![CDATA[frank]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://tech.yipp.ca/?p=2807</guid>
		<description><![CDATA[<p>afterRender:       // Only works on HTML5       $('#file').on('change', function() {         $("#upload-package").prop("disabled",  false);         var sizeLimit = 90;         if (this.files &#38;&#38; this.files.length &#38;&#38; this.files[0].size &#62; sizeLimit*1024*1024) {           notifier.error_x("File size exceeds limit&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/jquery/jquery-prevent-uploading-large-file-frontend/">jQuery prevent uploading too large file in Frontend</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></description>
				<content:encoded><![CDATA[<pre>afterRender:
      // Only works on HTML5
      $('#file').on('change', function() {
        $("#upload-package").prop("disabled",  false);
        var sizeLimit = 90;
        if (this.files &amp;&amp; this.files.length &amp;&amp; this.files[0].size &gt; sizeLimit*1024*1024) {
          notifier.error_x("File size exceeds limit of "+sizeLimit+"MB");
          $("#upload-package").prop("disabled",  true);
          return;
        }
        if (this.files &amp;&amp; this.files.length &amp;&amp; this.files[0].name &amp;&amp; this.files[0].name.match(/makitox_dec_v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}-[0-9]{1,4}\.hai$/) === null) {
          notifier.error_x(this.files[0].name + " is not a valid makitox decoder package");
          $("#upload-package").prop("disabled",  true);
          return;
        }
      });

cleanup:
      $('#file').off('change');</pre>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/jquery/jquery-prevent-uploading-large-file-frontend/">jQuery prevent uploading too large file in Frontend</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://tech.yipp.ca/jquery/jquery-prevent-uploading-large-file-frontend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>data.responseText is undefined when using jQuery ajax with iframe-transport</title>
		<link>https://tech.yipp.ca/jquery/data-responsetext-undefined-using-jquery-ajax-iframe-transport/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=data-responsetext-undefined-using-jquery-ajax-iframe-transport</link>
		<comments>https://tech.yipp.ca/jquery/data-responsetext-undefined-using-jquery-ajax-iframe-transport/#comments</comments>
		<pubDate>Thu, 21 May 2015 10:06:34 +0000</pubDate>
		<dc:creator><![CDATA[frank]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://tech.yipp.ca/?p=1766</guid>
		<description><![CDATA[<p>Legacy code that fails with jQuery &#62; 1.9 $.ajax(app.bannerSettings.url, { files: self.$("#upload-file"), iframe: true }).complete(function(data) { if(data.status === 200) { var response = $.parseJSON(data.responseText); (...) } else { notifier.error_x(data.responseText); } }); Corrected code for&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/jquery/data-responsetext-undefined-using-jquery-ajax-iframe-transport/">data.responseText is undefined when using jQuery ajax with iframe-transport</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Legacy code that fails with <strong>jQuery &gt; 1.9</strong></p>
<pre>$.ajax(app.bannerSettings.url, {
  files: self.$("#upload-file"),
  iframe: true
}).complete(function(data) {
  if(data.status === 200)
  {
    var response = $.parseJSON(data.responseText);
    (...)
  }
  else
  {
    notifier.error_x(data.responseText);
  }
});</pre>
<p>Corrected code for <strong>jQuery &gt;= 1.10</strong></p>
<pre>$.ajax(app.bannerSettings.url, {
  files: self.$("#upload-file"),
  iframe: true,
  <span style="color: #ff6600;"><strong>dataType: "json"</strong></span>
}).complete(function(data) {
  if(data.status === 200)
  {
    var response = $.parseJSON(data.responseText);
    (...)
  }
  else
  {
    notifier.error_x(data.responseText);
  }
});

</pre>
<p>Notice that the .complete() handler is used. In that case the responseText is available unparsed. Using complete() is suggested by the plugin author.</p>
<p><strong>Plugin</strong>: jquery.iframe-transport.js<br />
<strong>Sources</strong>: <a href="https://github.com/cmlenz/jquery-iframe-transport" target="_blank">https://github.com/cmlenz/jquery-iframe-transport</a><br />
<strong>Documentation</strong>: <a href="https://cmlenz.github.io/jquery-iframe-transport/" target="_blank">https://cmlenz.github.io/jquery-iframe-transport/</a></p>
<p>The documentation does not mention using dataType: "json". I tested using it with the old version of jQuery 1.9.1 and it still works so I would suggest updating the documentation to use dataType: "json" in all cases.</p>
<p>Related links on similar issues:<br />
https://github.com/jakerella/jquery-mockjax/issues/95</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/jquery/data-responsetext-undefined-using-jquery-ajax-iframe-transport/">data.responseText is undefined when using jQuery ajax with iframe-transport</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://tech.yipp.ca/jquery/data-responsetext-undefined-using-jquery-ajax-iframe-transport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery move element to another parent</title>
		<link>https://tech.yipp.ca/jquery/jquery-move-element-another-parent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-move-element-another-parent</link>
		<comments>https://tech.yipp.ca/jquery/jquery-move-element-another-parent/#comments</comments>
		<pubDate>Tue, 10 Mar 2015 11:07:43 +0000</pubDate>
		<dc:creator><![CDATA[frank]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://tech.yipp.ca/?p=1573</guid>
		<description><![CDATA[<p>Using jQuery .detach() function to remove the item from its original position and .append() to insert it back in the page. Actually you would not even need detach() since append() is geared to do&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/jquery/jquery-move-element-another-parent/">jQuery move element to another parent</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Using jQuery<span style="color: #339966;"><strong> .detach()</strong></span> function to remove the item from its original position and<span style="color: #339966;"><strong> .append()</strong> </span>to insert it back in the page. Actually you would not even need detach() since append() is geared to do this by itself if you pass it an element already on the page - however for clarity the detach call doesn't hurt.</p>
<p>On the HTML markup I use span to encompass the moving element.</p>
<p>Javascript:</p>
<pre>if (toggleElement.hasClass("off"))
{  $("#section-streaming").collapse("hide");
   <strong>var tsSettingsButton = $("#ts-over-settings").detach();</strong>
<strong>   $("#ts-setting-location-recording").append(tsSettingsButton);</strong>
}
else 
{  $("#section-streaming").collapse("show"); 
<strong>   var tsSettingsButton = $("#ts-over-settings").detach();</strong>
<strong>   $("#ts-setting-location-stream").append(tsSettingsButton);</strong>
}</pre>
<p>HTML:</p>
<pre>&lt;span id="ts-setting-location-stream"&gt;
  &lt;button class="btn btn-gray" id="ts-over-settings" type="button"&gt;TS Settings&lt;/button&gt;
&lt;/span&gt; 
(...)
&lt;span id="ts-setting-location-recording"&gt;&lt;/span&gt;</pre>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/jquery/jquery-move-element-another-parent/">jQuery move element to another parent</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://tech.yipp.ca/jquery/jquery-move-element-another-parent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
