Returning a PartialView with both HTML and JavaScript

I am making an AJAX call (with jQuery) to retrieve a PartialView. Along with the HTML I’d like to send back a JSON representation of the object the View is displaying. The crappy way that I’ve been using is embedding properties as hidden inputs in the HTML, which quickly becomes unwieldy and tightly couples far […]

JavaScript constructor parameter types

I have a JavaScript class representing a car, which is constructed using two parameters, which represent the make and model of the car: function Car(make, model) { this.getMake = function( ) { return make; } this.getModel = function( ) { return model; } } Is there a way to verify that the make and model […]

Mute Audio from Javascript?

I was sitting here wondering if it’s possible to write a greasemonkey script that would detect sites like payperclick and mute the audio so the ad isn’t heard. I realize that I could accomplish the same thing in a better fashion by simply removing the ad text through a greasemonkey script but for purposes of […]

Javascript security error 1000 when resizing text

I have a function that is mean to alter the font-size: // change the font size of the document function changeSize(fontSize) { var sheets = document.styleSheets; // Array of all stylesheets for(var i=0; i < sheets.length; i++) { // For each stylesheet var sheet = sheets[i]; // alert( sheets[i].title ); if(sheet.title == ‘textSize’) { // […]

Populating a FilteringSelect datastore from an onChange event

I’m trying to bind an onChange event of one FilteringSelect to populate another FilteringSelect. // View dojo.addOnLoad(function () { dojo.connect(dijit.byId(‘filterselect1’), ‘onChange’, function () { dijit.byId(‘filterselect2’).store = new { url: “/test/autocomplete/id/” + dijit.byId(“filterselect1”).value } ); }); }); The JSON is generated from what I can tell correctly from a Zend Action Controller using a autoCompleteDojo […]

Google Analytics Domain Tracking API _link() method

Has anyone else had any problems using google’s Domain Tracking API, I am specifically talking about the _link() method. The documentation is here The example provided shows that the _link() method should be used in the onclick event like this: <a href=”” onclick=”pageTracker._link(‘’);return false;”>Go to our sister site</a> However, this essentially just makes the link…do […]

JavaScriptResult in mvc RC1

Why do you need JavaScriptResult as a response? Doesn’t it break the pattern of clean separation of concerns? Can you suggest me some cases where this will be useful?

Question about [literally] mapping location based on an IP address

I’ve been bored lately and I want to start a new project. I was looking at a website mentioned in a different question (, and I thought the map and how it plots a point based on someone’s IP (I assume) is pretty nifty. I want to do something like that, but I have no […]

how to add markup to text using JavaScript regex

I need to add markup to some text using JavaScript regular expressions. In Python I could do this with: >>> import re >>> re.sub(‘(banana|apple)’, r'<b>\1</b>’, ‘I have 1 banana and 2 apples!’) ‘I have 1 <b>banana</b> and 2 <b>apple</b>s!’ What is the equivalent in JavaScript? string.replace(regex, newstring) seems to only take a raw string for […]

javascript setTimeout function out of scope

I am trying to call showUpload(); from within two setTimeouts. Neither works. It seems to be out of scope and I’m not sure why. I tried this.showUpload() which didn’t work either. $(document).ready(function(){ var progress_key = $(‘#progress_key’).val(); // this sets up the progress bar $(‘#uploadform’).submit(function() { setTimeout(“showUpload()”,1500); $(“#progressbar”).progressbar({ value:0}).fadeIn(); }); // uses ajax to poll the […]