I've got a few DOM elements, say text-field input A, B, C, and all of them have the property of 'onclick'. How do I find to which object a particular 'onclick' belongs?
I'm trying to write the logout of a website. When I do this I want the page to redirect to the login page. I think I'm doing it the correct way, but can't get the right result. Could you guys point me in the right direction?
Relevant Code:
<button onclick="logout()">Logout</button>
function logout()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.location=xmlhttp.responseText;
}
}
xmlhttp.open("GET","logout.php",true);
xmlhttp.send();
}
<?php
session_destroy();
header("Location:http://localhost:8888/loginns.html");
mysql_close($con);
?>
Thanks!
I know that the live() event handles event bubbling different than all other jQuery events. jQuery recommends using 'return false', but in my case that doesn't work.
The issue is:
I have a DIV which contains an anchor tag.
The DIV is bound using live(). Whenever I click the anchor tag inside this DIV it bubbles and calls the DIV's event. If I bind an event to that A tag which returns false it prevents the link from opening. Neither stopPropagation() or return false work in this case. Are there any other options? Ideally I'd like to keep the live() event around.
Hi all,
I am writing a web app with asp.net, c# and jquery.
Most of the time I'm writing dynamic html to the browser and using different web services to get the content needed.
My call to the service:
function WriteProducts(currentIndex, selectedCategoryId, callback) {
var d = new Date();
MyAppServices.GetProducts(selectedCategoryId, currentIndex, 8,
d.getTime().toString(), callback, function func() {
alert('failure');
});
}
The request usually gets translated to this (using firebug I monitored it):
http://localhost:8080/MyApp/MyAppServices.svc/GetProducts?categoryId=0&fromIndex=0&toIndex=8&randomNumber=%221271800014441%22
The problem starts when part of the html controls dynamically rendered need to respond to click events. This is when I start using jquery's live method:
$('.filter').live('click', function(event) {
WriteProducts(0, selectedCategoryId, PopulateDivs);
});
Now from some reason, the request passed to the server becomes this:
http://localhost:8080/MyApp/MyAppServices.svc/GetProducts?categoryId=**%2217%22**&fromIndex=0&toIndex=8&randomNumber=%221271799783355%22
where did these %22 come from? If I take them out, the request passes successfully.
I have no idea who inserted these %22, but they are causing havoc here!
Guys, do you perhaps have a clue?
i have following format of json in which i want to asscess 0.4 , kem , 2 , 2000 values
but it seems it doesn't have name index so how one can access it in jquery.
when i paste following code in json viewer then i am getting numerical index for 0.4 , kem , 2
"td": [
{
"@attributes": {
"class": "odd"
},
"span": [
"3",
"7"
]
},
"0.4",
"Kem",
"24\/04\/2010",
"2000",
"2",
"14000",
"Good",
"Buckley",
"56.0",
"2:05.32",
"36.65",
"54.5"
]
}
Hello Everyone.
I am new to Jquery. I want to read specific data(some div's only) from a webpage and store it in my database. Now I am not able to do so as load functions loads the data into the current page id. My goal is to read specific data and store them in database. So which Jquery function should I use for this? if someone can throw some light on it, it would be really helpful for me.
I am using JSP,MySQL,Java.
okay i have a question...
i need an message script that only will come up when people are really leaving
the current webpage so not the current website...
so actualli when people are leaving the website entirelly the message
will come up, they need to press the ok button to stay at the current page
and cancel to leave the entire website..
the script may not run when people are actually stay on the website or when the click
on internal links/pages..
does that make sence/?
and can it be done?
who know such code?
I'm trying to build a sort of resource allocation form. I'd like to be able to print a table from a database, and then allow users to click on each cell that they would like to reserve. Also, being able to drag and select multiple cells. Then send all of this via $_POST to another php script.
Problem is, I have no idea where to start.
Any suggestions?
TLDR I have a function that runs on the end of a pan in an openlayers map. Don't want it to fire continously.
I have a function that runs on the end of panning a map.
I want it so that it will not fire the function until say 3 secconds after the pan has finished. Although I don't want to queue up the function to fire 10 or so times like setTimeout is currently doing.
How can I delay a function from running for n seconds then run it only once no matter how many times it has been called?
How can i reset a display:none and add some value here is the code
onclick="$('reason{$test->id}').css('display:block');
$('#reasonid{$test->id}').val(this.value);"
At a website, I found the following code to make a jQuery plugin:
(function($){
// Our code here...
})(jQuery);
I don't understand how the code above works. What I understand is that the code executes immediately because the very last () in function(){}(). So the entire code says that is an anonymous function that is run immediately.
But I don't understand why the wrapping needs to pass jQuery and that inside it needs $ to be passed.
From my understanding, $ is an alias to jQuery, meaning practically the same. What is the meaning of $ and jQuery here? How does the overall code work as a jQuery plugin?
With Jquery, is there some way to make val() return an empty string instead of 'undefined' when called against an empty list of elements?
E.g., I have this code:
var x = $('#my-textbox-id').not('.watermark').val();
The idea is that I want to get the value of my textbox, but I want an empty string if it is currently showing the watermark (i don't want the watermark value!).
The selector works, but i don't want 'undefined' - I want an empty string ''.
I would like to keep the contents of large UI lists cached on the client, and updated according to criterial or regularly. Client side code can then just fill the dropdowns locally, avoiding long page download times.
How can I go about this? I mean, what patterns and strategies would be suitable for this?
I've been trying to set up a basic test animation using jsanim.js and using their example site to set up my html, css and js. However, I just can't figure it out (not a developer...designer!) and there isn't just a simple html, css, js file to download showing how to say animate a DIV left to right.
The examples of how the library works are clear but I'm lacking something in the set up and looking at their source on the site is nuts...too much going on in there.
Thanks to anyone with experience with jsAnim.js http://www.jsanim.com
Best,
Mark
Suppose I have an element on my page with id "some_id". I want to call a function as soon as I encounter this element. Something like following.
$("#some_id").call_a_function(function () {
// do stuff
});
Hi!
I want to embed some video into my HTML page. As background I want to use big picture. And above it I want to insert loop video with (i.e.) walking man.
So, can I embed video (without flash and any player controls) in page?
Can I decode video with transparent background? Is there any codecs which support transparent background (alpha-channel)?
Now I see this solutions:
Making flash (that I don't want to use)
Create gif animation (and it will be big file size and quite bad quality)
In an Adobe Air AJAX application with multiple windows running on a system with multiple (three or more) monitors, can you maximize the windows in each monitor? I've seen posts by others trying to do this, but I've not seen anyone saying how it worked out.
I basically need to build a 'status monitor' system (similar to, say, an airport departures monitor) in which there are public-facing displays that need to look and feel like single-purpose, embedded applications -- no window chrome and no visible desktop. I don't think this should be any different from any other windows application, but I don't know about Air. I have a dual-monitor Mac setup right now, but I can't easily test Windows and I likely will never be able to test three monitors at once.
This application will be run as an AJAX Air application written in Aptana (or DW if it makes a difference).
Morning,
I must be asking google all the wrong questions, because I can't find anything similar.
I have a standard navigation list, but I'm using page jumping because I wanted a single web page.
<ul>
<li><a href="#livestream">Livestream</a></li>
<li><a href="#media">Media</a></li>
<li><a href="#crew">Crew</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
But I can't for the life of me figure out how to make the class="current" when using page jumping. I've tried this bit of jquery because it appears to be what I'm looking for, but it did nothing. I don't think it'll work for #links.
Any ideas?
Hi everyone!
i'm a newbie in Jquey and i don't know how to do my homework, pls help me !
i have a String EX: this is my text, press here.
Now i put in o block character : [here]
how can a take slipt string and get text in [ ] into variable 'done'?
thankyou !
I don't mean for the title to be derogatory, but this is a rather frustrating problem, and I'm looking for a good workaround, given a language barrier involved.
I have a site set up for a plugin I wrote, and, rather than use the site's resources to write their own code, I've had people simply rip the code from the samples on the site. Normally, this wouldn't be any issue at all, but they are also taking my Google Analytics instantiation, so my Analytics data is getting very skewed by incorporating visitation data from their websites.
I've been able to contact the English-speaking site owners with little issue. The problem lies in the Japanese language sites that are yanking the code. I have no idea how to ask them to take down the analytics portion.
Long-term, I'm providing a package that streamlines the learning-to-use process, but in the meantime, what can I do about this language barrier? Is there a way around this problem that I haven't thought of?
I'm using an auto-complete widget from YUI to implement live search as in the examples. However, it works fine when search text is typed in, but fails to work when the text is pasted into the field. Which would be the proper way to initiate an autocompletion on paste? Haven't found anything for that in the documentation...
EDIT: Pasting is not Ctrl-V, it's usually "Paste" from the context-menu. YUI does react to a keypress, but doesn't if anything is pasted by the mouse.
What I have to work with:
An html table 5X7. On many queries, there are less that 35 items filling the complete table.
How can I "hide" the empty cells dynamically in this case, using jQuery (or any other efficient way)?
Thank you.