Recently had a case in hand to auto-fill a large multi-page form in a SPA for quick tests. This was a repetitive task so it made sense to have a script for it. The script had to be injected locally on my browser which then filled-in the form based on the type of fill that […]
javascript
Wait for stuff in javascript
This could be useful when on the browser we needed to wait for some stuff to happen or finish before I start processing a block of code. Here are some useful functions that can be quite handy Waiting for all ajax requests to finish (uses jquery). This uses the query $.active property to see the […]
Cross Domain Ajax using jQuery
Browsers by default don’t allow cross domain ajax. Conceptually we can implement JSONP (see http://en.wikipedia.org/wiki/JSONP) using jquery to do this. Here is an example <script type="text/javascript"> $(document).ready(function () { var s = $.ajax({ url: "http://someotherdomain.com/page?callback=?", context: document.body, dataType: "jsonp" }); }); function populate(data) { $(".info").html(unescape(data)); } </script> <button id="btn" value="click me" /> <div […]
Cross domain Ajax Queries
Cross domain Ajax queries are not allowed as per w3c scripting standards and attempts to do that will result in browsers restricting such scripts to run raising exceptions with messages like “Origin null is not allowed by Access-Control-Allow-Origin” or “Access to restricted URI denied” A widely used work around to handle Cross domain Ajax queries […]
Preloading Images using jQuery
useful tip to preload images using jQuery