Search Results

Search found 3 results on 1 pages for 'pagewil'.

Page 1/1 | 1 

  • Checking for Value in JS Object

    - by pagewil
    I have a JS Object like so: var ob{ 1 : { id:101, name:'john', email:'[email protected]' }, 2 : { id:102, name:'jim', email:'[email protected]' }, 3 : { id:103, name:'bob', email:'[email protected]' }, } I want to check if this JS object already contains a record. If it doesn't then I want to add it. For example. if(ob contains an id of 101){ //don't add john }else{ //add john } Catch my drift? Pretty simple question. I just want to know the best way of doing it. Thanks Guys! W.

    Read the article

  • Moving .JS files to a CDN: How to manage AJAX requests?

    - by pagewil
    I am thinking of moving my static .JS files to a CDN such as Amazon S3 for performance reasons. As my PHP files and mySQL DB remain on my primary hosting domain what is the best way to manage my JS AJAX requests if they are now cross domain? Currently they look like this within my .JS file (with relative paths): $.ajax({ type: "POST", url: "/myNearbyPhpFile.php", data: {data:someData}, success: function($r){} });

    Read the article

  • requireJS : How to structure Javascript for an entire site?

    - by pagewil
    I have 3000+ lines of javascript that I need to get into a sensible/maintainable structure. I have chosen to use requireJS as it has been recommend to me by a few people. I have a bunch of variables that are used throughout the application and need to be available everywhere. I also have a bunch of functions that need to be available everywhere. Apart from these two dependencies most of the code can be divided off into their own modules. I am having trouble understanding how to manage my main variables so that if one module of code makes changes to the variables the rest of the JS modules will see that change. I think I need to see a few examples that demonstrate how requireJS is intended to work on a larger scale that the examples in the documentation. If anyone is an experienced requireJS user I would love the hear your tips!

    Read the article

1