Ok. I'm totally baffled. Here's the code:
$(document).ready(function(){
var newToken = 1;
$.get("junk.php",
function(newToken) {
alert(newToken); // alerts "junk"
});
alert(newToken); // alerts "1"
});
As per my comments, the first alert of newToken is "junk" (the only output of junk.php). Once outside the .get, ne...
I'm struggling to create a shoutbox for django. Everything works fine now concerning reading data from the database, but when I want to add a new shout the whole page is being reloaded, and from what I was able to check - form's action remains the same, and there is no request sent to function under specified url. What am I doing wrong h...
Does anybody know if there is a way to embed a link inside of a Colorbox? So, for example, I have clicked an image and opened up a Colorbox popup, then place a link in the caption to another page? Or just navigating to a different page by clicking on the image?
I'm sure there is a way, but i am a little new with Javascript/JQuery.
It...
Hello everyone. I have a problem with an Ajax app that I'm trying to get working with the browser's Back and Forward buttons. I am using the jQuery History plugin to enable the browser history.
The app consists of a page of products. There is a sort bar that enables the user to sort products by various values. The user may select a prod...
If someone clicks on a link within a div with the class "foo" I want the list items within this div to show. How can I do this?
Here's my failed attempt:
$('div > li').hide();
$('div.foo > a').click(function(event) {
$('div.foo > li').show();
event.preventDefault();
});
<ul>
<div class="foo">
<a hr...
My prototype code no longer works when I load in the jquery library, even though jquery is the first library to be loaded.
The html of the page looks a bit like so:
<head>
...
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/effects.js"></script>
<script type="text/javascript" src...
I'm using Google App Engine (Python) along with jQuery for Ajax calls to the server. I have a page where I want to load up a list of strings in Javascript from an Ajax call to the server.
The server method I want to invoke:
class BrowseObjects(webapp.RequestHandler):
def get(self):
ids_to_return = get_ids_to_return()
...
Whenever I do a JSONP call through jquery to any page I set up (either locally or on my server) all I get is the silent treatment. Firebug reports 200 OK and the response looks ok. I setup alerts boxes to popup on success or
failure but neither appears. It doesn't seem to matter what url I use, nothing pops up.
BUT if I use the twitt...
Hey,
I have the following lines of code:
var search = $("#txtSearch").val();
search.replace(" ", "%20");
$(".header").html("/Parts/Search.php?type=" + $("input[name=type]:checked").val() + "&q=" + search);
$(".main-content").load("/Parts/Search.php?type=" + $("input[name=type]:checked").val() + "&q=" + search);
I know there is a text...
I'm using a CMS to allow users to add keywords to their profiles, but I'm wanting to limit that to 10 keywords, which are comma delimited, by counting the number of commas (in this case, 9).
Any ideas on how to go about doing this with jQuery? I'll be doing a double-check on the server-side, but I'd like a quick little, live error check...
Im trying to have my background fade in onclick with jquery and im unsure on how to do it.
Here is my code:
$(".work").click( function(){
$("body").removeClass('bg2 , bg3').addClass("bg1");
});
$(".about").click( function(){
$("body").removeClass("bg1 , bg3").addClass("bg2");
});
$(".contact").click( function(){
$("body...
I'm using the following script to do inline field labels, but I would like to have it also validate the fields before the user submits the form. I only have 3 fields in the form, Name, Email and File upload, can anyone please help me? If I use a separate validation script, it will not recognize the fields as being empty because this scri...
I've got a bunch of h4 tags that I want to wrap in a <span class="red"> </span>
Some of the text is like this: $12 and some has a space like $ 5
How can I wrap all instances of $ and the numbers that follow with jQuery?
Let me clarify. I want to have this <h4> this item is <span class="red">$42</span> and on sale</h4>
...
I cant figure out why the this alert() part below is not working when I call it from $.getJSON???
function parseInfo(data)
{
alert("getJSON worked");
}
Firebug says I connecting to the server with a 200 OK code
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=u...
I'm a noob with jQuery and I know about scrollTo, but not quite how to get it to function on my site. I did a quick Google search and found lots of results, but at a glance the most reliable one (or at least most popular) currently used is this one: http://plugins.jquery.com/project/ScrollTo
However, again, being a total noob to scripti...
I have an onChange event that needs to dynamically select an ID and then add a preset classname to pass to a function.
onChange = "show(document.getElementById(this.value). {select a class here? } );"
The equivalent in jquery
$('#'+this.value+'.myclassname').function();
So how do I select an ID+classname in javascript? I know I'm ...
I'm brand new to jquery and am not even sure if I'm referring correctly to the "parent" element. I want to remove the two <li> tags completely. Is there a way to do this with only a single id declaration?
<li class="remove"><a href="#">ds</a></li>
<li class="remove"><a href="#">xfg</a></li>
<li><a href="#">ds</a></li> <------This sta...
Hi can anyone assistant me with getting this piece of jquery code to work properly. I like jquery but a lot of the times developers are very vague on how to use there custom coding. I guess they just assume you should know certain things. I'm trying to use this on a Form with checkbox, radio, dropdown and inputbox then have a php file ha...
Hi all, I'm trying to write up a script that will allow me to change the css of the previous li on hover.
Here's the structure:
<ul id="mainlevel">
<li><a href="/" class="mainlevel" id="active_menu">Home</a></li>
<li><a href="/" class="mainlevel">About Us</a></li>
<li><a href="/" class="mainlevel">Products</a></li>
<li><a href=...
I'm having some difficulty with writing some jQuery code. What i'm trying to do is pass multiple methods through an event handler like so $(foo).click(methodOne , methodTwo); The purpose of the first method is to fade out the current view and then hide it and the purpose of the second method is to display an alternate view. For whatever ...