javascript

weird jQuery JSON function... whats going on here?

Im browsing the flot examples here http://people.iola.dk/olau/flot/examples/turning-series.html (view source once there) I came across this : <script id="source" language="javascript" type="text/javascript"> $(function () { var datasets = { "usa": {... The $(function() part. I get that its an anonymous function, I dont g...

Trying to access the options of a dropdown box using jQuery/javascript, but it's saying that .options is undefined?

I'm creating a dropdown box dynamically in jQuery by appending html as follows: .append("<br><SELECT NAME='Month_list' class='month_selection'</SELECT>"); It gets created fine, but I'm trying to dynamically add options to it using the following code: $('.month_selection:last').options.add(new Option(month_array[index])); but I'm g...

Javascript Arrays - Alternative to arr[arr.indexOf()]?

var arr = [foo,bar,xyz]; arr[arr.indexOf('bar')] = true; Is there an easier way to do this in JS? ...

Updating a Drop down list with Jquery from JSON

I have a list that I need to fill using a JSON collection of object. Here is what my action is returning: public ActionResult GetProductCategories() { var categories = _entities.ProductCategories.ToList(); var result = new List<SelectListItem>(); foreach (var category in categories) ...

How to show this Success message on popup .

I have this code in my view. After my database adding the message is showing perfectly but my Grid is not showing the updated result. If I keep return true; when I click Submit button I am getting popup window immediately and then adding to the database? This showing my updated result in the grid. ...

Different sort algorithms visually performed

Any decent visualization of a couple different sort algorithms? I'm looking for something I can use in a demo, and willing to write my own (can't be that hard) but would prefer to use someone else's if I can. NO applets though, the majority I'm finding are applets... Lightweight flash or canvas. I would like the following sorts: Bubbl...

Rails remote_function, can I set the id dynamically on the client side with javascript?

I try this: remote_function(:url => {:controller => '/cities', :action => 'show'}, :method => 'get') But I get a routing error because I didnt specify an ID. But I want the ID to be able to change depending on a value that the user selects on the page at runtime. So then I tried this: remote_function(:url => {:controller => '/citie...

javascript url regex

Hello, Currently i have a input box which will detect the url and parse the data. So right now, i am using var urlR = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+) (?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/; var url= content.match(urlR); problem is, when i enter url like www.google.com, its not working, whe...

AJAX returning a javascript to be parsed results in loss of page contents

So I've been working recently on a script to obfuscate client-side code for protecting intellectual property without interfering with the appearance of interactivity of the resulting page. The process is as follows: HTTP request comes in, .htaccess redirects (.*) to parse_request.php parse_request.php creates a "phpURLParser" class who...

GET parameters to change my .php external javascript file to load different content

If I use GET parameters to change my .php external javascript file to load different content based on the page non of the browsers are going to cache that file right? they will treat global_js.php?page=foo and global_js.php?page=bar as if they had different names and load the content again right? or should I include something in my heade...

How i catch the response from a server

When i create a form like this: <form method='POST' action='gate.py'> <input type='file' /> </form> 1) How i cant catch the response from the server, on a script? 2) I can send in a async way a file? Thanks in advance. ...

jQuery tab slider

Hey all, i am trying to find a good example of this type of slider HERE. I can not seem to find the "official" name for it so i really can't search for it. The effect that i am trying to find is that of the triangle that moves/slides depending on which tab you click on. Any help would be great! :o) David ...

3D rotation with Axis & Angle

I know 3D rotation is well documented on SO and many other sites, but despite reading countless explanations I still haven't figured out where I'm going wrong. My background is in art and design, not math and programming, and I'm never really certain if my angle of attack (no pun intended) is the right one. Rather than paste a patchwork ...

Javascript: I need a good data structure to keep a sorted list

This would probably be implemented as a tree or something? My point is it needs to be efficient. I don't know where to find good implementations of data structures for Javascript for something like this, though. I don't want to have to roll my own if I can avoid it. Help appreciated. ...

Can we call the function written in one JavaScript in another JS file?

Can we call the function written in one JS File in another JS file? Can anyone help me how to call the function ? ...

extJs Alert Help

var encClinic = new Ext.chart.StackedBarChart({ store: new Ext.data.Store({ reader:encReader, url:data.jsonUrl, baseParams:{ cmd:'OHMjson.Graph', graphName:'ENC', graphType:'Clinics' } }), yField: 'CLINIC', xAxis: new Ext.chart.NumericAxis({ stack...

Javascript how do I find what function call resulted in a specific UI event??

I want to find out what triggered an event. Namely, the notification bar on this site stackoverflow.com (the bar that tells you when someone has posted an answer to a question you're writing an answer on. It scrolls down slowly from the top and provides a really nice UI for user notifications. I've seen it work on just about ever page. ...

Render OpenFlashChart image automatically within Rails

Hi, i've found this tutorial in the internet to render flash object (OpenFlashChart) as an image in PHP. http://teethgrinder.co.uk/open-flash-chart-2/save-image-js.php Unfortunately i've tried to do the very same thing but failed to do so, becauset of different implementation procedure in Rails. Does anyone here knows how to render o...

Detect HTML in ASP.NET

(clarification: this is an old question that has been tweaked for admin purposes) There have been a fair amount of questions on this site about parsing HTML from textareas and whatnot, or not allowing HTML in Textboxes. My question is similar: How would I detect if HTML is present in the textbox? Would I need to run it through a regul...

Why can't this checkbox, created dynamically with jQuery, be clicked?

jsFiddle I'm using a jQuery plugin that allows the user to draw boxes in an area. I use jQuery to put a checkbox (along with a dropdown list) in the box that appears when the user lets go of the mouse button (this is towards the bottom of the javascript in the jsFiddle). The problem is, the checkbox is unclickable. I do have some clic...