javascript

Best javascript libraries to work with rails?

I want to develop an application with simple Quiz-like games (think of a question , answer, a timer, high-scores/ranking, not much more) For that I want to use Rails and some javascript library that let me have some modern effects on the GUI (being a GUI the least you can ask is for an atractive interface) I first considered ExtJS but ...

parsing a Value in JQuery ??

var valueAsText = $('#counts span').text(); i use this tiny script to parse a span that contains the value 10, but i got this value instead 100000000000 can someone tell me what is wrong? and here is the code: <div id="counts"> <span>10</span> </div> thanks. ...

[jquery] javascript formatting opinion: ' vs "

In looking up jquery examples, I see that authors tend to go with ' or " to enclose, selectors, for example. As in: $('#tags').click ... or $("#tags").click Is this a personal style thing, or is there a reason why one is better than the other? In my brief experience, I find that ' is faster to type. Also, building up json paramete...

How to check if a JSON response element is an array?

I am receiving the next JSON response { "timetables":[ {"id":87,"content":"B","language":"English","code":"en"}, {"id":87,"content":"a","language":"Castellano","code":"es"}], "id":6, "address":"C/Maestro José" } I would like to achieve the next pseud...

jQuery delay between animations

I have two elements that shouldn't be active at the same time, so when one is toggled I fade the other out, however I would like to be able to fade the open element out and then bring the other one in. Is there a way to do this that isn't a hack? <script ="text/javascript"> $(function() { $('#jlogin').click(function() { $('#login')....

How can you push data to a web page client?

I just learned about the AJAX Push Engine but it runs on Linux/Apache which is not an option for me. http://www.ape-project.org/ Currently with AJAX to keep a page current I have to poll the server frequently which is not great for a high traffic site. The option to push data to the client only when necessary is a great option, but nat...

How to include js files in asp.net MVC and have a valid path on all routes

I created a default ASP.net MVC project. In the Master page I have the following at the top <head runat="server"> <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title> <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> </head> I then need to add a javascript file and added the line as...

Javascript global error handling

I would like to catch every undefined function error thrown. Is there a global error handling facility in Javascript? The use case is catching function calls from flash that are not defined. ...

Javascript: Have body onload function wait until scripts have completed

I have some functions that I am calling and they take some time (milliseconds), but I don't want the page to display until these functions have completed. Right now, I can tell that the page loads and then the scripts eventually complete. Right now, I am calling the functions in the body onload. Also, another issue I may have is that ...

Can javascript running inside an iframe affect the main page?

Partial Code: My below code pulls a query from my DB and then uses inner.HTML = to display the data inside a div. It works fine in it original use.... However the below version is called inside a iFrame as it is used to update the page. The page has no errors and the JavaScript fires however the last line does not work... I have just...

JS Image Pre-loading blocked?

Hello, I am using a JQuery Plugin called lightbox (which is great btw). Problem is, I am accessing images on external sites and I think they are blocking lightbox from preloading them. Specifically I have confirmed that picasa gives the preloader a 404 (using firebug), but if I right click the failed request in the firebug "net" tab, a...

Is it true that Jquery + Rails is problematic?

I saw comments in a previous question saying that it is best to use Prototype with Rails. However, my own experience is that Jquery is a superior Javascript library. Being new to Rails, I have not yet investigated how to use Jquery with Rails but I assumed this would work. Is it correct that this may be a problematic combination - especi...

How does one track with JS where the visitors are going?

Let me reformulate, as the answer http://stackoverflow.com/questions/951907/where-are-my-visitors-going was absolutely correct, but my question not precise enough ;) How does one track with Java Script where the visitors are going? (From a technical standpoint.) Is the idea to execute a code every time a link is pressed? If yes, does t...

Do any search engines index web page source code?

As far as I'm aware, search engines (on the web) typically index only the "user facing" content of a web page. But what if you wanted to find pages(s) that contain a certain fragment of HTML or JavaScript. Is this possible? Do any web-wide search engines provide this feature? Or do you think that it would not be worth implementing? ...

very simple javascript failing.

Working Example: This is almost identical to code I use in another places on my page but fails here for some reason. <?php //$p = "test"; ?> <script> alert('posts are firing? '); parent.document.getElementById('posts').innerHTML = "test"; </script> Failing example: (alert still works) <?php $p = "test of the var"; ?> <script> aler...

Why do frame breakers work cross-domain, and can you conditionally use frame breakers?

I've been investigating frame breaking code recently and have come across some really bizarre behavior related to the same origins policy that I am having trouble understanding. Suppose I've got a page Breaker.html on domain A, and a page Container.html on domain B. The example frame breaker code would go into Breaker.html, like below:...

Safari doesn't allow AJAX Requests after form submit?

I am writing a Javascript based upload progress meter. I want to use the standard multipart submit method (rather than submitting the file in an iframe). During the submit, I send ajax requests that return the % complete of the upload and then update the progress meter accordingly. This all works smoothly in FireFox & IE. However, Safa...

What do you do to your JavaScript code before deployment?

Do you have a step in your deployment process that minifies JS? Do you have any sort of preprocessor for your JavaScript that allows you to leave in comments and console.logs and then have them automatically stripped out? Is your JavaScript machine generated by GWT or Script#? Do you use ANT or another tool to automate deployment? I see...

Javascript using variable as array name

I have several arrays in Javascripts, e.g. a_array[0] = "abc"; b_array[0] = "bcd"; c_array[0] = "cde"; I have a function which takes the array name. function perform(array_name){ array_name = eval(array_name); alert(array_name[0]); } perform("a_array"); perform("b_array"); perform("c_array"); Currently, I use eval() to do ...

jQuery calls in external js file with MasterPages

I am using ASP.NET 3.5 with MasterPages. My master page has the script references to jquery and jquery UI. My web page that uses the master page has a script reference for a custom javascript file for that page. This javascript file has jquery calls in it (i.e. document.ready --> set up input boxes as calendars). When I run the websi...