javascript

Rails controller does not accept JSON?

Hi All, I am trying to create an ActiveRecord object via a JSON request. However the controller fails to set the variables passed in the parameters in the newly created object. As an example, a person object has two fields: firstname and lastname. The JSON generated by the JSON.stringify function of the JSON.org library produces: {"fi...

Javascript HAML editor

Does anyone know of a Javascript based HAML editor out there? I'm looking for for something like TinyMCE that just understands HAML (so it does indenting and highlighting correctly) I'm thinking of using an editor like this for a dynamic website I'm building. Clarification The site I am building allows the users to define layouts(in t...

How do I determine whether a page is secure via JavaScript?

I want to know if the page is being accessed via http or https using JavaScript. Is there some sort of isSecure() method, or should I just parse it out of the URL somehow? ...

The Google Maps Wikipedia Layer

Is there a way to programmatically list all geo-tagged Wikipedia entries within a radius of a long/lat point? I'm thinking this is possible with the google maps API but I am interested in any method. NOTE: I do not want to display a googlemap. ...

Access DOM elements after ajax.load

I am inserting the HTML response from an AJAX call into my page, but then when I try to access those elements after they have been created, it fails.. This is how i retrieve and insert the HTML: $.ajax({url: 'output.aspx', data: 'id=5', type: 'get', datatype: 'html', success: function(outData) {$('#my_container').html(out...

Check if ValidationSummary is Valid using OnClientClick

Is there a way to check if a ValidationSummary control has its IsValid property set to true using Javascript in the OnClientClick event of a button? What I'm trying to do is to show a message that says "please wait while your file is uploading" on an upload page, but if I use javascript to show that message, it shows up even when the V...

Is there a way to determine when 4 images have been loaded using JS?

I have 4 images on a page. I want to trigger a JS event once all 4 images are loaded. I of course can't be sure which order the images will be loaded in, so I can't trigger the event on the last image. One thought was to have a counter, but I can't think of the best way to check when that counter is equal to 4 as I don't like the idea of...

Floating columns both ways Javascript

I am trying to float columns using css so they stack up evenly like on this blog: http://typeneu.com It seems to be impossible using css so I am looking in to javascript. The website listed above uses this javascript file: http://typeneu.com/wp-content/themes/grid-a-licious/scripts/grid-a-licious.js I have tried to implement it to exp...

Best method of Instantiating an XMLHttpRequest object

What is the best method for creating an XMLHttpRequest object? It should work in all capable browsers. ...

ExtJS: AJAX Links in Grid in Tab in Window

I am working on my first project using ExtJS. I have a Data Grid sitting inside a Tab that is inside a Window. I want to add a link or button to the each element of the grid (I am using extended elements at the moment with HTML content through the RowExpander) that will make an AJAX call and open another tab. ...

Why is this wrong? (use of "this" with jQuery)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"&gt;&lt;/script&gt; <script type="text/javascript"> function bigtosmalltriangle() { $(this).siblings("div.break").removeClass('triangle3').addClass('triangle1'); setTimeout ( "smalltomediumtriangle()", 400 ); } function smalltomediumtriangle() { $(th...

Clone a file input element in Javascript

I have a file input element that needs to be cloned after the user has browsed and selected a file to upload. I started by using obj.cloneNode() and everything worked fine, that is until I tried using it in IE. I've since tried using jQuery's clone method as follows: var tmp = jQuery('#categoryImageFileInput_'+id).clone(); var clone =...

prototype and jQuery peaceful co-existence?

I know very little about JavaScript but despite this I'm trying to cobble something together on my wordpress blog. It's not working, and I don't know how to resolve it, and hey, that's what StackOverflow is for, right? Firstly, the error message is: Error: element.dispatchEvent is not a function Source File: http://.../wp-includes/js/p...

Javascript: var map = {}; var list = [];

Can someone tell me what exactly the two above lines of javascript do? And more importantly, what it's called so I can search some javascript references to learn about it? I assume they are both creating some form of an array that objects can be added to...? ...

Smarty Vs. Javascript/AJAX

I have a doubt: - Is there any standard/convention that when should I use "Smarty templating" and when should I use Javascript Ajax calls to produce the content? I can use Ajax/Javascript calls to produce the content dynamically. My application uses both Ajax and Smarty, but I want to set a rule for developers ...

How to create an endless picture-show without marquee?

I wrote a module for Joomla! 1.5 which shows the pictures (banners) with the most clicks. Now I want to show this list scrolling on the home-site. With "marquee" there is a break after the last picture. I've found an advice which said I'll have to create a div-container with overflow: hidden and a second div with javascripte which change...

How to preview a file on the server in JBoss

I need some ideas on how I can best solve this problem. I have a JBoss Seam application running on JBoss 4.3.3 What a small portion of this application does is generate an html and a pdf document based on an Open Office template. The files that are generated I put inside /tmp/ on the filesystem. I have tried with System.getProperties("...

Get variable from php to javascript

Hi friends, I want to use the php variable in javascript. How its possible? Please help me.. ...

What are php nested functions for?

In javascript nested functions are very useful: closures, private methods and what have you.. What are nested php functions for? Does anyone use them and what for? Here's a small investigation I did <?php function outer( $msg ) { function inner( $msg ) { echo 'inner: '.$msg.' '; } echo 'outer: '.$msg.' '; inner( $...

AVM2 and ABC (Adobe's ActionScript bytecode format) spec licensing.. can I use it?

Google is failing me on this one. Let's say I have some ECMA script that I've compiled to an ABC bytecode file using the compiler in the Open Source Flex SDK. Is it within the terms of use (That I can't seem to find) for me to use the AVM2 specification from adobe to create a new interpreter for this file? The best I can manage is a s...