Search Results

Search found 7642 results on 306 pages for 'js riddler'.

Page 44/306 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • passing dynamic values in callback method

    - by swastican
    is there a way to pass dynamic values to callback function in js or jquery or nodejs. for(var i = 0; i < 10; i++) { filename = 'file'+i+'.html'; request(url, function(error, response, body) { test(error, response, body, filename); }); function test(error, response, body, filename) { console.log('file name ' + filename); if(response.statusCode == 200){ console.log('done'); } } I refered this so article for passing values to callback function. link: [JavaScript: Passing parameters to a callback function the output always seems to be 9 How can i pass values dynamically? The callback function always refers the last value of filename.

    Read the article

  • A brief question about JS or AJAX

    - by Luke
    I have been finding ways around this for a long time but think it's time I addressed it. If I have a page that has a dropdown menu, is there anyway I can select a value which will subsequently load other values further down. Can this be done without a page reload? I will give you an example. Say I was making some tools for an admin panel, but first of all they needed to select a member to work with. They would select the member and then below, the fields about that member would be populated based on what was selected in the first menu. As I have already asked, can this be done without a page reload? Thanks for reading.

    Read the article

  • Force download through markup or JS

    - by mschoening
    Lets assume I have a file on a CDN (Cloud Files from Rackspace) and a static html page with a link to that file. Is there any way I can force download this file (to prevent it from opening in the browser -- for mp3s for example)? We could make our server read the file and set the corresponding header to: header("Content-Type: application/force-download") but we have about 5 million downloads per month so we would rather let the CDN take care of that. Any ideas?

    Read the article

  • regular expression on replace method of js not working

    - by user950146
    why this is not working var value = arr[row][col].replace(new RegExp('"', 'g'),'""'); Error : Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0) Timestamp: Tue, 10 Apr 2012 11:22:01 UTC Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Message: Object doesn't support this property or method Line: 1041 Char: 25 Code: 0 URI: http://example.com/? Note: : Error copied directly from debugger of IE8

    Read the article

  • Javascript object encapsulation that tracks changes

    - by Raynos
    Is it possible to create an object container where changes can be tracked Said object is a complex nested object of data. (compliant with JSON). The wrapper allows you to get the object, and save changes, without specifically stating what the changes are Does there exist a design pattern for this kind of encapsulation Deep cloning is not an option since I'm trying to write a wrapper like this to avoid doing just that. The solution of serialization should only be considered if there are no other solutions. An example of use would be var foo = state.get(); // change state state.update(); // or state.save(); client.tell(state.recentChange()); A jsfiddle snippet might help : http://jsfiddle.net/Raynos/kzKEp/ It seems like implementing an internal hash to keep track of changes is the best option. [Edit] To clarify this is actaully done on node.js on the server. The only thing that changes is that the solution can be specific to the V8 implementation.

    Read the article

  • Understanding NoSQL Data Modeling - blog application

    - by Rushabh RajeshKumar Padalia
    I am creating an blogging application in Node.js + MongoDB Database. I have used relational Database like MySQL before but this is my first experience with NoSQL database. So I would like to conform my MongoDB data models before I move further. I have decided my blogDB to have 3 collections post_collection - stores information about that article comment_collection - store information about comments on articles user_info_collection - contains user inforamtion PostDB { _"id" : ObjectID(...), "author": "author_name", "Date": new Date(....), "tag" : ["politics" , "war"], "post_title": "My first Article", "post_content": "Big big article" "likes": 23 "access": "public" } CommentDB { "_id" : Objectid(...), "POST": "My First Article", "comment_by": "User_name", "comment": "MY comments" } UserInfoDB { "_id": ObjectID(...), "user": "User_name", "password": "My_password" } I would appreciate your comments.

    Read the article

  • [DOM/JS] display table in IE

    - by budzor
    I have code like that: var xPola = 10, //how many cols yPola = 10, //how many cols bokPola = 30, //size of cell body = document.getElementsByTagName('body')[0]; var tablica = document.createElement('table'); body.appendChild(tablica); for( var y = 0; y < yPola; y++ ) { var rzad = document.createElement('tr'); tablica.appendChild(rzad); for( var x = 0; x < xPola; x++ ) { var pole = document.createElement('td'); pole.setAttribute('width', bokPola); pole.setAttribute('height', bokPola); rzad.appendChild(pole); } }; it works fine in FF, Chrome & Opera (it displays 10x10 table with 30px width&height rows). In IE nothing happens. I check in firebug lite and it is in HTML section, inside BODY tag but i see nothing. Whats wrong?

    Read the article

  • Toastr.js notifications as modal notfication

    - by Maxsteel
    I know it's not what toastr (or toast notifs in general) are meant to be used for, but I want to use them as a modal notification. My idea is following. On toast show: toastr.options.onShown = function() { //Create an overlay on the entire page} Overlay: #overlay { background-color: rgba(0, 0, 0, 0.8); z-index: 999; position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: none; } And on toast close: toastr.options.onHidden = function() { //make overlay go away } Also, I'm setting timeout of toast to 0 so it won't disappear by itself. Question: I want the toast notification to stay atop the overlay and not behind it as overlay will cover everything. How can I do it?

    Read the article

  • Angular.js: value() not injected in config()

    - by Nik
    I am having trouble getting the value() injected into the app.config(). Here's the code (coffeescript) window.app = angular.module("app", []) app.value("template_path", "assets/angular/templates/users") app.config(["$routeProvider","template_path" ($routeProvider, template_path) -> console.log template_path it is throwing an "Unknown provider: template_path from app" error Could it be that the config() method cannot be injected with value() set values? I am using 1.0.2 Thank you!

    Read the article

  • Issue pushing object into an array JS

    - by Javacadabra
    I'm having an issue placing an object into my array in javascript. This is the code: $('.confirmBtn').click(function(){ //Get reference to the Value in the Text area var comment = $("#comments").val(); //Create Object var orderComment = { 'comment' : comment }; //Add Object to the Array productArray.push(orderComment); //update cookie $.cookie('order_cookie', JSON.stringify(productArray), { expires: 1, path: '/' }); }); However when I print the array this is the output: Array ( [0] => Array ( [stockCode] => CBL202659/A [quantity] => 8 ) [1] => Array ( [stockCode] => CBL201764 [quantity] => 6 ) [2] => TEST TEST ) I would like it to look like this: Array ( [0] => Array ( [stockCode] => CBL202659/A [quantity] => 8 ) [1] => Array ( [stockCode] => CBL201764 [quantity] => 6 ) [2] Array( [comment] => TEST TEST ) I added products to the array in a similar way and it worked fine: var productArray = []; // Will hold order Items $(".orderBtn").click(function(event){ //Check to ensure quantity > 0 if(quantity == 0){ console.log("Quantity must be greater than 0") }else{//It is so continue //Show the order Box $(".order-alert").show(); event.preventDefault(); //Get reference to the product clicked var stockCode = $(this).closest('li').find('.stock_code').html(); //Get reference to the quantity selected var quantity = $(this).closest('li').find('.order_amount').val(); //Order Item (contains stockCode and Quantity) - Can add whatever data I like here var orderItem = { 'stockCode' : stockCode, 'quantity' : quantity }; //Check if cookie exists if($.cookie('order_cookie') === undefined){ console.log("Creating new cookie"); //Add object to the Array productArray.push(orderItem);

    Read the article

  • PHP or JS to connect with fingerprint scanner save to database

    - by narong
    I have a project to set profile user and save all data to database include fingerprint also. i don't what i should start, I have USB finger scanner already to test. What i think: i should have a input box to read data from USB finger scanner than i should create a function to upload it database. but with this thinking i meet problem: i don't know data that get from USB finger scanner is image or data? if image, how i can read it to input box to save to database ? Anyone have any idea, please share me to resolve it. I am looking to see your helping soon! thanks

    Read the article

  • Splitting Nucleotide Sequences in JS with Regexp

    - by TEmerson
    I'm trying to split up a nucleotide sequence into amino acid strings using a regular expression. I have to start a new string at each occurrence of the string "ATG", but I don't want to actually stop the first match at the "ATG". Valid input is any ordering of a string of As, Cs, Gs, and Ts. For example, given the input string: ATGAACATAGGACATGAGGAGTCA I should get two strings: ATGAACATAGGACATGAGGAGTCA (the whole thing) and ATGAGGAGTCA (the first match of "ATG" onward). A string that contains "ATG" n times should result in n results. I thought the expression /(?:[ACGT]*)(ATG)[ACGT]*/g would work, but it doesn't. If this can't be done with a regexp it's easy enough to just write out the code for, but I always prefer an elegant solution if one is available.

    Read the article

  • Get next key-value pair in an object

    - by captainclam
    So, given a key, I want to find the next property in an object. Then, I want to return the value of the NEXT property. I can not rely on the keys to be ordered or sequential (they're uuids). Please see below for trivial example of what I want: var db ={ a: 1, b: 2, c: 3 } var next = function(db, key) { // ??? } next(db, 'a'); // I want 2 next(db, 'b'); // I want 3 I also want a prev() function, but I'm sure it will be the same solution. This seems like such a trivial problem but I can't for the life of me figure out how to do it. Happy for the solution to use underscore.js or be written in coffeescript :)

    Read the article

  • require.js - How can I set a version on required modules as part of the URL?

    - by Ovesh
    I am using require.js to require JS modules in my application. I need a way to bust client cache on new JS modules, by way of a different requested URL. i.e., if the file hello/there.js has already been cached on the client, I can change the file name to force the browser to get the new file. In other words, for the module hello/there, I'd like require.js to request the url hello/there___v1234___.js (the file name can look different, it's just an example), according to a version string which is accessible on the client. What is the best way to achieve that?

    Read the article

  • I want to style within JS

    - by 422
    Issue I have is I can use tags, but I would like to style particular words. Adding a class doesnt work, is it because I am within script dom ? Example: var config = [ { "name" : "tour_1", "bgcolor" : "black", "color" : "white", "position" : "BR", "text" : "Customize your user profile, it's easy. This is your shop window on <strong>here</strong> and <strong>there</strong>", "time" : 4000 } Instead of strong, I would like to apply class, like <p class="orange"> But it wont have it, any suggestions... please

    Read the article

  • MooTools is not a function js error

    - by Adriane
    hello whatever i append to $('click_filter1') it shows the error ... is not a function (for show(), hide(), toggle()) if i insert an alert, the alert gets executed, so the framework is init ok the element with the id exists for sure what can be the problem of this? why iam getting this error? $('click_filter1').addEvent('click', function() { $('click_filter1').show(); }.bind(this));

    Read the article

  • With JS add default date on TextBox

    - by senzacionale
    <asp:TextBox ID="txtDate" runat="server" AutoPostBack="true" OnTextChanged="txtDate_TextChanged"></asp:TextBox> how can with Jquery add default date. I do not know where and when to call this code: function addDefaultDate() { if ($('#txtDate').val().length == 0) { var now = new Date(); $('#txtDate').text(now.getDate() + '.' + now.getMonth() + '.' + now.getYear()); } }

    Read the article

  • Is it easy to develop a simple Firefox plugin (JS injection)

    - by Moons
    Hello everyone! So I was just wondering if it was easy to develop a very simple Firefox plugin where you could click a button, and it would execute some Javascript code! Please note that I have never developed any kind of plugin for firefox, I just want to know if that is an easy task to do (like less than an hour)

    Read the article

  • JS Split ( ) to check if substring exists in Array

    - by Javacadabra
    I have an array of products that are stored as Strings in this format productname:quantity. The issue I am running into is that if a user adds one product with a quantity of x it is inserted into the array as it should. However, if they then decide to add more of a particular product a new entry is made into the array instead of checking if the product already exists and adjusting the quantity to the new value. oldQty + newQty. For example this is my array: ["CBL202659/A:1","OUTER9:1","PALLET CARDS:1"] If I add another PALLET CARDS product it creates a new entry rather than updating the quantity of the existing item to 2. New array ["CBL202659/A:1","OUTER9:1","PALLET CARDS:1","PALLET CARDS:1"] I would like the array to end up like this: - updating the quantity ["CBL202659/A:1","OUTER9:1","PALLET CARDS:2"] Currently this is my code: I use the split() method to seperate the String where a colon occurs and store the product name and quantity in two seperate variables. $(".orderBtn").click(function(event){ //Show the order Box $(".order-alert").show(); event.preventDefault(); //Create the Array var productArray = []; //Get reference to the product clicked var stockCode = $(this).closest('li').find('.stock_code').html(); //Get reference to the quantity selected var quantity = $(this).closest('li').find('.order_amount').val(); var item = stockCode + ":" + quantity; var itemCheck = stockCode + ":"; if(quantity == 0){ console.log("Quantity must be greater than 0") }else{ //If no Cookie exists, create one and add the Array if ($.cookie('order_cookie') === undefined) { console.log("CREATE NEW COOKIE"); //Add items to Array productArray.push(item); //Add Array to Cookie $.cookie('order_cookie', JSON.stringify(productArray), { expires: 1, path: '/' }); //If the Cookie already exists do this } else { productArray = JSON.parse($.cookie('order_cookie'));//get ref to array if(productArray.indexOf(itemCheck)!= -1){//It exists so update qty console.log("EXISTS... updating item: " + itemCheck); //var index = productArray.indexOf(item); //var update = productArray[index].split(":"); //var name = update[0]; //var oldQty = update[1]; //console.log(name + ":" + oldQty); //productArray[index] = item; }else{//It does not exist, so add to array console.log("Does not exist... adding new item: " + item); //Append items onto the Array productArray.push(item); } //Update the Cookie $.cookie('order_cookie', JSON.stringify(productArray), { expires: 1, path: '/' }); console.log($.cookie('order_cookie')); } //Display the number of items in the Array in the Order Box $('#order_counter').html(productArray.length); } }); I suppose the real question I am asking here, is if it is possible to search the array for a subString - containing productname: ??

    Read the article

  • Hide / show content via CSS:hover (or JS if need be)

    - by Chris
    I have the following html: <li> <span class="one">Stuff here</span> <span class="two">More stuff</span> </li> .one { display: block; } .two { display: none; } What is the easiest method, preferably CSS only, to hide one and show two when the mouse rolls over the <li> container. If this cannot be done via CSS and only Javascript, I would prefer jQuery via something like live() as the content is updated live and do not wish to constantly rebind manually. EDIT: I forgot to mention that this has to work in IE6 :/

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >