javascript

Synchrony on web service and browser calls

I have a HttpHandler which queries 3 web services within a single request and store the results in a single cookie. As you would imagine, the results collide. Here is how: Process is as follows: when i query service 1 and waiting for the result, the cookie i m storing the results doesnt exist yet, then result comes from service 2 and v...

MongoDB console javascript can't be used in application?

At the MongoDB developer zone you can learn all the MongoDB console javascript API to use for document CRUD operations. I wonder, do all these javascript functions only work on the MongoDB console? I learn all that just to use it for administrative tasks or can I use them in my javascript application (node) as well? ...

why use external javascript?

What are pros of using an external javascript file? I just can't figure it out, I see big websites using them all around several times instead of server-side includes. Is it just for caching? If it's a matter of clean code and seperation of concerns, then you can still include it from the serverside into the html. For example I use SMAR...

Help me with algorithm.. Javascript

On my page I'm making ajax-request to get data from server. The data is list of JSON objects.. Every object has name, description and datetime. How can I get the object which is the closer to my real data in browser... Example: $(json).each( function(i) { alert(json.datetime) //here have to be some algorithm to c...

How to connect to a third party website in classic asp using javascript for password encryption and yet not giving in the password.

Hi I have to make changes to classic asp website where once a button is clicked it autologins to a third party website with a intermediate page that warns that you are logging in to a third party website. The thirdparty is providing us with a username and password and gave us an examle javascript to encode the password to send to them...

Javascript engine with good interoperability with JVM and CLR

Due to the huge resources behind it, Javascript seems to rapidly becoming the scripting language of choice for applications, particularly those with a web front end. I have an application that requires extensibility both on the front and backend. Javascript, or a thin wrapper like CoffeeScript, seems like an excellent, future-oriented, ...

Best way to manage and initialize JS objects that represent DOM elements

When creating a web page who's content will be created and destroyed dynamically by the user, what is the best way to structure and initialize both the javascript functionality and the DOM Elements? Example -- Lets say you have a todo-list who's items can be re-ordered, created, and destroyed by the user: Each Item will have a visual ...

What's the best practice method for storing raw php, javascript, html or similar in a mysql database?

The example web page has 2 fields and allows a user to enter a title and code. Both fields would later be embed and displayed in an HTML page for viewing and/or editing but not execution. In other words, any PHP or javascript or similar should not run but be displayed for editing and copying. In this case, what is the best way to escape...

Creating a multi-page PHP form with sessions

I need to create a pretty extensive form with PHP/MySQL with a lot of conditional logic that ultimately ends with submission to the MySQL database. So basically the user makes their first choice with a radio button (has to be because they are "choosing" pictures) and then gets taken to the next "page" of the form based on that submissio...

SpiderMonkey: How do i get the name of the current JSObject from c?

Hello, someone asked how to get the value of a JSObject property from c. That helped me a bit. But, does anyone know how to get the current JavaScript name of an object from c? example: var foo={prop:'bar'}; then somewhere for example in jsapi.cpp: JS_somemethod(JSContext *cx, JSObject *obj){ //how do i get the name 'foo' (or the...

JSlint error 'Don't make functions within a loop.' leads to question about Javascript itself

I have some code that invokes anonymous functions within a loop, something like this pseudo example: for (i = 0; i < numCards; i = i + 1) { card = $('<div>').bind('isPopulated', function (ev) { var card = $(ev.currentTarget); .... JSLint reports the error 'Don't make functions within a loop.' I like to keep my code...

jquery, replace input with select for example time picker like in google calendar

Hello, im trying to reproduce following effect. I have two input elements on form: class=time and id=timefrom class=time and id=timeto i want to hide/remove this elements create select element with hours and minutes example 00:00 00:30 01:00 01:30 02:00 ... Second element should be dynamic for example selecting in first element 01...

how to return to top of for loop in javascript

Maybe this is a dumb question but is there a way to return to the top of a loop? Example: for(var i = 0; i < 5; i++) { if(i == 3) return; alert(i); } What you'd expect in other languages is that the alert would trigger 4 times like so: alert(0); alert(1); alert(2); alert(4); but instead, the function is exited imm...

Is it possible to develop a Google App Engine web app using Node.js or some other server side JavaScript approach?

I've been following the latest developments with server-side JavaScript - especially Node.js - and wondering if there is any possibility of using such an approach to develop a Google App Engine web application - either separately from or in combination with Python or Java? ...

unable to get form elements by using form name in javascript

I am having an issue with accessing my form by it's name. When I use document.form[0].mylink.value it recognizes the value and outputs to the innerHTML that I specify. However, when I use document.myform.mylink.value it doesn't seem to recognize the form. I have tried this in chrome 6.0 and also firefox 3.6.3 and get the same result i...

Updating a loading/saving message in JavaScript that clears after all callbacks are complete

I'm building an AJAX app that constantly saves to the server when the user changes things. Every time the user changes something, I want a status area to say "Saving..." (with animated ellipses) and then change back to "Saved" at the callback (when the server returns) In theory this is easy enough, because I could change the status area...

Sqlite in Adobe Air, Data type mismatch

Hello, I've been using Adobe Air framework (with JavaScript) and a sqlite 3 database. Everything worked fined, but after a while the Db started throwing Data type mismatch: could not convert text value to numeric value errors. As best I can recall, I've done no modification to either the database schema or the JS code. The SQL command is...

Facebook Logout Confusion

I have a strange problem, I have a logout link that displays only if the user is logged in. I have this code inside the the onclick event of this link (using a function): FB.logout(); window.location = 'http://www.google.com'; If I click on this once, nothing happens, I know that the function gets executed because I've tested ...

Javascript OOP library for client and server-side js (node.js)

Hi, is there any Javascript OOP library to easily work with classes, inherence and the like in a more class-based way to avoid prototypical OOP that works with JS both on the client (browser) and on the server (in my case Node.js, but generally that uses javascript core functions, so that can be used no matter the interpreter)? Thanks....

How do I pass a variable using window.open()?

I would like to add some variables when my window.open function fires. Example: <a href="javascript:void(window.open('Details.aspx', 'Title'))"><%# Eval("Id").ToString) %></a> I would like to pass the id number to the Details.aspx page. How do I do that? ...