In a JQuery getJSON call, how can I tell the length of the JSON that's returned?
function refreshRoomList() {
$.getJSON('API/list_rooms',
function (rooms) {
if (rooms.length > 0) {
$("#existing-room-list").empty();
$("#join-existing-room").text("Join existing room:"); // th...
I'm not even sure if I worded the question right, but I'll try and explain as clearly as possible with an example:
In the following example scenario:
1) Take a class such as this:
public class foo
{
public string firstName {get;set;}
public string lastName {get;set}
}
2) Serialize that into JSON, pass it over the wire to the...
var Dog = function() {
var _instance = 'hello world';
return function() {
console.log(this._instance);
}
} (); //note that it is self invoking function
var l = new Dog(); //#> undefined
In the above case I was expecting output of 'hello world'.
Why this._instance is not accessing the the varible which should be...
The jQuery.getJSON() method seems to ignore the normal rules of scoping within JavaScript.
Given code such as this...
someObject = {
someMethod: function(){
var foo;
$.getJSON('http://www.somewhere.com/some_resource', function(data){
foo = data.bar;
});
alert(foo); // undefined
}
}
...
instead of a whole page refresh after a certain time, i'd just like a specific div container to reload/refresh. is there any way to do this?
<div id="wrapper">
<div id="quoteContainer"></div>
</div>
...
I'm adding a facebook comment widget to a website. I'm placing this widget in a file that is included on everypage. The navigation is relatively linked so it switches back and forth from http and https. But for some reason the comment widget only shows up if both the src linked file and webpage is secure or both the src linked file an...
Hi!
I have one large div with one smaller div inside it. The smaller div is at first displayed as hidden. When the user hovers the mouse over the large container-div the smaller div is animated in with the show/hide-functions. So far everything works fine.
However. The smaller div is animated in from the bottom - so if I let the cursor...
I want to make a bookmarklet so that when I go on Digg, I can simply click it and have the top 10 stories open up in new tabs.
The HTML on the page looks like this:
<div id="topten-list">
<div class="news-summary img-thumb">
<h3>
<a href="/comics_animation/Pokemon_COMIC">Pokemon - (COMIC)
<span>
<em style="ba...
Hello folks,
Upon user interaction, I need to remove certain input params from an HTML form before submission. Using javascript to remove the input fields from the DOM doesn't seem to actually remove the params from being sent through the request.
Is there a way to delete or clear the actual request params?
...
i cant run any function on ie this is a little part;
my test page : http://www.yetkineren.com/testpage.html
code:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>test page</title>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js">
</script>
<s...
I'm trying to implement an assets/dependency loader that i've found from an old article at 24Ways.org. most of you might be familiar with it. it's from this article by Christian Heilmann:
http://24ways.org/2007/keeping-javascript-dependencies-at-bay
i've modified the script to load CSS files as well. and it's now quite close to what i ...
Is there any way I can make Firefox call a JS function in my extension whenever it completes a download (passing the path of the downloaded file)? Thanks for any help.
...
I have a web site that I am trying to get completed and I need to have the user click points on a map and then work out the route on the roads between the two points. So the user clicks the first point on 1st street, and then clicks another point on 4th street, and the map will find the best way to get there and plot the route on the ma...
So i am working on a project and need some advice.
I have a MySQL database that stores events, i know how to code this functionality in PHP but im just stuck of a few specifics.
As the project that I am creating is a timetable, the most important attributes are the day of the event, starting time and finishing time.
Once i have read t...
I have a popup function in a program that works well, be re-loads the parent page as it loads the child. Is there a way to prevent this behaviour.
// popup window function
function newPop(url, myWin, width, height, left, top, scrollbars) {
parms = 'toolbar=yes, scrollbars=no, location=no, menubar=no, resizable=no, width= ' + width ...
I am trying to add time to a Date object in javascript but am not getting the results that I am expecting. I am trying to pull a timer off of the page and add it to the current time to get the unix timestamp value of when the timer will hit zero. The time on the page is displayed as " HH:MM:SS ". This is what I have:
time=getTimerTex...
Here's the quick version of the code as it stands right now:
function foo(attributeName, someJSObj, key, newValue)
{
someJSObj[key].attributeName = newValue;
}
Obviously this doesn't work, since it just creates a new element called attributeName. Is there an easy way to dereference the attributeName into the string that represent...
Hi All,
Having an issue here that I have tried everything I can think of but cant get it to work. I have a page with a link that creates a cfwindow like so
function create_window(ID){
var config = new Object();
config.modal=true;
config.center=true;
config.height=775;
config.width=700;
config.resizable=false;
...
On Window's load, every DD element inside Quote_App should have an onCLick event appended that triggers the function Lorem, however, Lorem returns the nodeName and Id of the last element in the For statement rather than that of the element that trigged the function. I would want Lorem to return the nodeName and Id of the element that tri...
Preface: I consider myself "slightly effective" in ruby on rails, and a complete novice in javascript. Also, yes, I have installed jQuery and associated plugins instead of the default Prototype library.
I am in a situation where I am pulling in a table from off-site in an iframe (which is taking care of all internal JS for me) such that...