How to optimize the ajax requests in Jquery?

I am building a mobile app using jquery mobile, jquery and php back-end. My problem is in certain pages I am sending and receiving multiple ajax requests which are visibly slowing down the performance and causes memory leaks which leads to the crashing of app in low network connections What are the possible ways of […]

Redux reducers — changing deeply-nested state

I’m trying to wrap my head around how to change deeply-nested state in redux. It makes sense to me to combine reducers and change first-level properties of the state for those pieces. Where I’m not so clear is on how to change the state of a deeply-nested property. Let’s pretend that I have a shopping […]

How to get the first part of this basic loop exercise right?

I am learning Javascript from the book Eloquent Javascript by Marijn Haverbeke, there is exercise at the end of second chapter(Program Structure). Write a loop that makes seven calls to console.log to output the following triangle: # ## ### #### ##### ###### ####### I tried to solve it like using a for loop. var hash […]

Passing values to ko.computed in Knockout JS

Ive been working for abit with MVC4 SPA, with knockoutJs, My problem is I want to pass a value to a ko.computed. Here is my code. <div data-bind=”foreach: firms”> <fieldset> <legend><span data-bind=”text: Name”></span></legend> <div data-bind=”foreach: $parent.getClients”> <p> <span data-bind=”text: Name”></span> </p> </div> </fieldset> </div> self.getClients = ko.computed(function (Id) { var filter = Id; return ko.utils.arrayFilter(self.Clients(), […]

Javascript : How to enable stopPropagation?

With object.stopPropagation() I can stop event bubbling but how can I re-enable it? Is there a pre defined function in js something like object.startPropagation? EDIT: The Problem is that the JS remembers if you click on the “object” than stop Event Bubbling always even after I don’t want it, so I would like to stop […]

Isotope Overlapping Images?

It seems like it only happens in Chrome and Safari.. not Firefox. I’m using it with the foundation responsive framework so I’m not sure what to do about setting the height. It also seems there isnt enough spacing between the images in Chrome/Safari.. How do I fix this? Edit: Here is a fiddle http://jsfiddle.net/TLjay/ The […]

Javascript – check if div contains a word?

How can I check if a div contains a certain word? var divs= document.getElementsByTagName(‘div’); for (var i = 0, len = divs.length; i < len; ++i) { if (divs[i].text = ‘*word*’){ //do somthing } } doesn’t work.

How to get value of translateX and translateY?

I want to get translateY value from the in-line css with the JavaScript. Here is the in-line value: style =”transition-property: transform; transform-origin: 0px 0px 0px; transform: translate(0px, -13361.5px) scale(1) translateZ(0px);” These code give to me the total list in to variable: var tabletParent = document.getElementById(“scroller”); var toTop = tabletParent.style.transform; console.log(toTop); console.log translate(0px, -12358.8px) scale(1) translateZ(0px) […]

Building contextify under Windows 7 x64 (for NodeJS jQuery)

I try to get node-jquery working. contextify is one of the dependencies (required for jsdom). contextify needs to be built somehow using Python. But this does not seem to work on Windows 7 x64. At least one my computer 🙂 After some readings (#10, #12, #17) and trying some binaries provided by this fork and […]

Google custom search for images only

Since Google image search API is deprecated, one should use Google custom search API for this. I’ve made a small example using it. My problem is I want to return google image search results only. Whereby this shows web results, and the user may switch to the image result. How can I show only the […]