Tag Archives: jQuery

jQuery load/parse JSON response

jQuery load/parse JSON response jQuery.parseJSON( json ); Takes a well-formed JSON string and returns the resulting JavaScript value, probably object or array of objects. Passing in a malformed JSON string results in a JavaScript exception being thrown. For example, the following are all invalid JSON strings: “{test: 1}” (test does not have double quotes around it). “{‘test’: 1}” (‘test’ is ... Read More »

Javascript for loop vs jQuery for each

Javascript for loop vs jQuery for each Web developers often come across looping through data at client side. People generally use native Javascript coding for loop, or jQuery for each. Javascript For Loop. Example var names= ["anoop", "kumar", "rai"]; var i; var text=""; for (i = 0; i < cars.length; i++) { text += names[i] + ","; } document.write(text); Result-> ... Read More »

jQuery detecting scroll- scroll reaching to the bottom of page

jQuery detecting scroll- scroll reaching to the bottom of page Detecting scroll and executing login based on scrolling has important significance in web development like implementing pagination, where more data gets loaded when user scrolls near the bottom of page. So, first basic question arises as to how to detect scroll. window.onscroll = function(ev) { //execute your logic here } ... Read More »

How to handle jQuery cross domain AJAX request

Cross Domain jQuery AJAX request AJAX Requests are only possible if port, protocol and domain of sender and receiver are equal, means that the following below listed requests won’t work- Requesting https://serverA.com/a.php from http://serverA.com/b.php Requesting http://subdomain.serverA.com from http://serverA.com Requesting http://serverA.com:5000 from http://serverA.com Here in this tutorial we will cover the ways to handle this restriction. First lets look at the ... Read More »