JQuery :: Passing Variable Into YQL Statement?

Apr 17, 2011

I'm having a tough time trying to add the "zip" variable to my YQL statement.

var zip = $(this).attr('zip');
$.YQL("select * from rss where url='http://weather.yahooapis.com/forecastrss?p=' ' "+ zip +" ' ", function(data){
var w=data.query.results.item;

[Code].....

I've tried as many different ways as I could imagine. Simply putting the literal zip code in the query works perfect.

View 2 Replies


ADVERTISEMENT

JQuery :: If Statement And Passing Click Event

Mar 16, 2010

I got a pretty large function, one that could essentially be condensed (if you feel so inclined). I would like to know how I can get my if statements inside the toggle functions working properly. I have 4 functions and 2 of them are click functions for closing (display:none). I would like to pass a listener to the toggle funciton to listen for the $close.click(). The if statement in the toggle functions is not doing anything.

<script type="text/javascript" >
$(document).ready(function(){
var $contactLink = $("#contactLink");
var $contactBox = $("#contact-container");
var $qrLink = $("#qrLink");
var $qrBox = $("#qr-container");
var $qrBack = $("#qrBack");
var $contactBack = $("#contactBack");
$contactBox.css("display","none");
$qrBox.css("display","none");
$contactLink.toggle(
function(){
if($contactBox.css("display","none")){
$contactBox.css("display","inherit");
alert('here'); .....

View 2 Replies View Related

JQuery :: Applying Variable To If Statement?

Jun 17, 2010

Need to apply a var to a statement if its conditions are met, this syntax isn't throwing errors but its not working.

<script type="text/javascript">
$(document).ready(function(){
var action_is_post = false;
//stuff here

[Code].....

should I use something other than .ready? I need it to apply the var when #stepDesc0 has the class current.

View 9 Replies View Related

Jquery :: Input A Variable In If Statement?

Dec 1, 2010

Below is a working code.

1. if($('input[name="test"]').is(":checked"))
2. {
3. // my other code
4. }

I want to remove "test" and put a variable there instead

I tried this way but it does not seem to work.

1. newData="test";
2. if($('input[name=$(newData)]').is(":checked"))
3. {
4. // my other code
5. }

View 3 Replies View Related

JQuery :: If Statement - How To Set Variable First When Page Reloads

Jul 1, 2010

I've made the following script:
$(document).ready(function(){
var showHide = $.cookie('menuStatus');
alert(showHide);
/* Part that dosnĀ“t work.
if (showHide==closed) {
$("#menu").hide();
}
*/

$(".openClose").click(
function(){
$("#menu").slideToggle("slow", function() {
if ($(this).is(':hidden')) {
//var state = "closed";
$.cookie('menuStatus', 'closed');
} else if ($(this).is(':visible')) {
//var state = "open";
$.cookie('menuStatus', 'open');
}
//alert(state);
});
});

Now this is the example: [URL]. When page loads, you get an alert, with the var showHide, which should be open or closed. Problem is the if statement. I must say it was exciting to make this little script with jQuery. Especially setting the cookie, I couldn't have done it without the jQuery plugin. As you can see I tried to set a variable first but when page reloads, the variable was reset.

View 2 Replies View Related

Passing Parameters In A Window Statement?

Dec 31, 2009

I am trying to grab firstname from the previous form page and pass it into my open window command.

<script type="text/javascript">
{
window.open("https://www.MyWebsite.com/Myform.html?firstname=getQueryStringVariable('firstname')")
}
</script>

The above does not come out properly, I get entire GetQueryString etc in the Target URL

What should the syntax be, I think I may also be using the wrong javascript command, I think it should be a FormRequest, hmm not really sure.

View 1 Replies View Related

Setting Variable Equal To Php Variable By Passing A Parameter?

Aug 12, 2011

Code:I am having problems with the following. I am wanting to hide <tr> in my table (employees) and only show employees that are in the selected department (selected via dropdown box).I need to set a javascript array to a php array. I am looping and assigning the array and am wanting to pass a javascript variable as the index in php array. I have marked my problem lines in red. Thanx for any help.

<script type="text/javascript" >
function display_elements()
{
var departments = new Array;

[code]....

View 1 Replies View Related

Pass A Variable Into Actual If Statement

Mar 10, 2009

Is it possible to pass a variable into a if statement, What I mean is the function takes in variables i need to take one of those variable and put it in the actual statement.I need the check variable to be put in the if statement but all it does is throw an error because it can't find "check".

View 4 Replies View Related

Adding IF Statement To Variable Message?

Oct 22, 2010

I have been assigned the old Pizza Form tutorial. My form asks for customer info, select size with radio button, and select toppings with checkboxes.I created a ValidateForm() function to check if these are filled in and output a message for each field saying "please fill in field."My problem now is that on Submit I need to print out a message with customer info, selected size, and selected toppings.I have the customer info done with a var message:

var message = "Name: " + name + "
";
message += "Address: " + address + "

[code]...

View 3 Replies View Related

Using The Switch Statement And Variable Scope?

Jun 14, 2010

I've created a jQuery script that uses a switch statement. However, my experience with it, relative to variable scope, doesn't seem to follow the logic.According to the JavaScript/jQuery theory, a global variable was accessible (meaning read & write) throughtout any function within any script (one that page).However, apparently that theory wasn't completely true as it pertained to switch statements that contained variables. To illustrate my case in point, I've included a simplistic version of my code:

$("#selector").delegate("div", "click", function(event) {
var testVar = 4;
switch (this.id) {

[code]...

As shown, the variable "testVar" is not accessible from one case to the next case .Furthermore, to add insult to injury, I am seeing the same behavior within the conditional if else statement counterpart to the switch statement.

View 1 Replies View Related

If Else Statement Not Working With Global Variable

Oct 13, 2010

The first time I enter the command n it should run the first if statement, when I enter n it should then run the second one as its in zone two. However this is just not happening..

// gameFunctions.js
// Javascript file for Game.html
// September 29th 2010 Edition

[Code]....

View 2 Replies View Related

JQuery :: Passing Variable To Ajax?

Mar 29, 2011

<script>$(document).ready(function(){
$('td img').click(function(){
alert($(this).attr('id'));
});
$.ajax({

[Code]...

I am new to jquery and I was wondering on how to send the id of the image I clicked on to a ajax call.

View 2 Replies View Related

JQuery :: Passing A Variable To A Selector?

Dec 3, 2010

function findDivs(id)
{
$('div[id~="' + id + ''"]').innerHTML = "insert this text into div's with id that contains the variable: id";
}

So the selector i am using isn't working. I'm pretty new to jQuery so the selector may be completely off.

View 1 Replies View Related

JQuery :: Passing Variable Between Dialogues?

Sep 16, 2010

I want to pass a variable between dialogue boxes but can't get it to work:

<script type="text/javascript">
function deleteE(v,m,f){
if(v == true) {
$.prompt('Enquiery Deleted.',{callback: del, buttons: {OK: true}, persistent: true}) ;

[Code].....

I have got the process for removing the record from the database to work fine, it's just getting this value from the first box to the last and into the php file.

View 2 Replies View Related

JQuery :: Passing A Variable To A Function?

Aug 15, 2010

if this is such a obvious question, but i'm kind of newbie in JQuery, i am using a lightpop plugin, & i want to pass 'image_path' via html. lightpop plugin code is something like this:

(function(jQuery){
jQuery.browser = jQuery.extend(
{chrome: /chrome/i.test(navigator.userAgent)} ,
jQuery.browser

[Code]...

View 1 Replies View Related

Variable Doesn't Work In An Object Statement

Feb 19, 2010

I have an input form that accepts numbers. I am trying to compare the last field value to the current field value. My problem is that when I use the variable name of the last field in an object path, I get the error "null or not an object". The var 'L' is the problem in the statement below. If I manually type the field name in place of 'L', it works fine. How do I have to write this statement so 'L' works?

Problem statement:

c=window.document.save_info.L.value;

Here is my code: Form element:

Code:

<input style="border:1px solid gray; background-color: #FF9;" onkeyup="moveOnTwo('frm_score1',<?PHP echo $num_holes; ?>,this,'frm_score2')" size="1" maxlength="3" name="frm_adjsc1" id="frm_adjsc1" />

JavaScript Function:

Code:

function moveOnTwo(lastFieldID,holes,field,nextFieldID){
var L = lastFieldID ; var N = nextFieldID;

[code]...

View 3 Replies View Related

JQuery :: Form Select: Passing And Using Variable?

May 27, 2011

I have a set of select form elements. What I want it to do is this.

when I select 'tiger', then I want it to trigger and update the div 'description.'

How would I go about doing this.. I am relatively new to jQuery.

View 6 Replies View Related

JQuery :: Ajax Name Value Pairs And Passing Variable?

Jul 20, 2011

Basically I want the field name to be a variable but it is taking it as a literal.When I print back the POST array with PHP I get:- Array ( [field_name] => Whatever I typed )So if the text field has a name of 'username' then I want the PHP to print back

Array ( [username] => Whatever I typed )

$(function(){//on DOM.load
$('.register-field').blur(function() {
var field_val = $(this).val();

[code]....

View 1 Replies View Related

JQuery :: .load() - Passing Variable Data?

Dec 31, 2011

I'm trying to pass a var via object to .load() ... .load(URL, {"myname":var}, function) { ... This will not work unless the var is in quotes and therefore not a variable anymore. I want to be able to use a form to feed data to the program that loads the data.

View 8 Replies View Related

JQuery :: Passing A Variable Through An Attribute Filter?

Nov 3, 2009

This is my very first post! so please be kind Ok, i am very novice to jQuery. But what i am trying to do is use the jQuery attribute selector to select an input with a specific name. I can select an input of name type fine by doing the folowing:

[Code]...

View 2 Replies View Related

JQuery :: Passing A Variable From Html To An External Js

Aug 11, 2009

I've used jquery to create a tabbing system and I want to be able to use it on multiple pages. I want to be able to pass a variable containing the number of items in the list from the html to the js file. Inside the js file I have this function:

[Code]...

View 2 Replies View Related

JQuery :: Passing A Variable In [attribute] Selector?

Dec 17, 2010

I am new to jQuery. How can I select all the elements with a given number and which has 0 has value and set to a specified value.

[Code]...

View 3 Replies View Related

JQuery :: Passing A Variable From The Calling Script?

Oct 11, 2010

I've looked extensively for the answer to this but suspect my inexperience means I'm using the wrong "keywords" in searches, or the answer involves jquery beyond my comprehension.

I have script experience and have plug-in galleryView working but have no jQuery experience which is the problem.

The script:

<script type="text/javascript">
name
= getValue("name");
$(document).ready(function(){

[Code]....

Variable name contains data stripped from the page URL (www.url.com?name=3). I want to use this variable in the jquery array/list passed into the galleryView instead of the number 3. How can this be achieved? I suspect this could be done entirely in jquery (if I had the experience) or via the getdata script used above?

View 6 Replies View Related

JQuery :: Passing Array Variable From HTML?

Sep 26, 2011

I am trying to pass a variable from gsp to jquery. But I have a problam.I have variable a which contains 635 element. like this a = [2,555,43,32,43,........]Here I am grabing this value fromgsp to jquery..

<html>
<head>
<script>

[code]....

View 5 Replies View Related

JQuery :: Passing Variable Gives Empty String

Oct 5, 2011

I have this image gallery in which clients should be able to determine the order in which their images are shown. The sortable part works. Then I want to pass the new order to the next page called act_writeneworder.cfm (i am using coldfusion)
I just started with jQuery and it is driving me nuts:-) Each time I think I am having it well i am testing and the variable passed through gives an empty string.
My code:

<script type="text/javascript">
$(function() {
$( "#ulsortable" ).sortable();
});

[Code]......

View 2 Replies View Related

JQuery :: Passing Event Variable Using 1.7's .on() Function?

Nov 14, 2011

I'm having issues while passing the triggered event with .on.

obj.on('click', feedmania.handler.itemFeedmania.toggleFormComment);
I've tried:
obj.on('click', feedmania.handler.itemFeedmania.toggleFormComment(e));
obj.on('click', function(e){feedmania.handler.itemFeedmania.toggleFormComment(e)});

[Code]...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved