Multiple XMLHTTPREQUESTS And Queuing...
Apr 16, 2006I can't seem to get more than one request to fire simultaneously... and
I have read there should be at least 2 possible (in IE) and more in
Firefox....
I can't seem to get more than one request to fire simultaneously... and
I have read there should be at least 2 possible (in IE) and more in
Firefox....
I've got multiple xmlhttprequests which are in a loop. So this is the
loop I have so far, with the closure given to me in a previous post:
//-------------------------------------------------------------------------------------
for (i=0; i<data.length; i++) {
httpRequest[i] = false;
httpRequest[i] = new XMLHttpRequest();
httpRequest[i].onreadystatechange = function(index) {
return function () {
if (httpRequest[index].readyState == 4) {
if (httpRequest[index].status == 200) {
var stats = getStats(httpRequest[index].responseText,
data[index]);
updateStats(statsTable.rows[index], stats);
}
}
};
}(i);
httpRequest[i].open('GET', URL, true);
httpRequest[i].send(null);
}
//-------------------------------------------------------------------------------------
So basically, the getStats method parses the response to get the info
I need for that particular request and then updates the html of the
current page accordingly. This works fine for 1, 2, or 3 data
requests. But if I have more, some of the httprequests get lost and
not all parts of my page are updated. But, if I throw in an alert in
each loop, all page data or at least more of them are updated, once
per time after each loop. It's like the alerts slow the loop down and
allow the requests and updates to catch up to the loop processing.
So, I'm not sure what's happening when the alerts aren't there. Are
some of the requests getting clobbered somehow? Are the httprequests
fine, and maybe the original document can only be updated once at a
time?
I'm just trying to get used to jquery. I decided to try and make a simple drop down menu so I used the jquery show/hide effect with mouse events. I just have issues with this effect and wonder if I am going about it in the right way. here is my code for the show/hide:
$(".menu").mouseenter(function() {
$(".submenu", this).show("fast")
});
$(".menu").mouseleave(function() {
$(".submenu", this).hide("fast")
});
If I move my mouse over the mouse event area the menu opens the way I want it to and If I move my mouse off the mouse event area it closes the way I want it to. But if I do it rapidly its like jquery has to open and close the menu for each instance I go over or out of the area and it has to play "catch up". My mouse could be inactive and somewhere off in the corner and the menu is opening and closing "x" amount of times to complete all its tasks. From what I understand this is called "queueing" in jquery and this feature can be turned off so I tried something like this:
$(".menu").mouseenter(function() {
$(".submenu", this).clearQueue().show("fast")
});
Doing this causes a worse problem because now if I go rapidly eventually they won't even open at all. In the best case I would like the menu to have a slight delay when I move the mouse off of it and then when I return the mouse to the menu I would like it to cancel the previous "mouseleave" event.
It is possible through the show effect or should I should I be using the animate effect to create a custom animation. If so what do I "animate" with the animate effect. I tried ".animate({dispaly: "show")} but all that does it quickly shows the menu and then it disappears.
to explain the basics of my menu design the class "menu" has the top level menu title within that element itts child is the submenu element with all the submenu items on it. The submenu is set to absolute positioning so it doesn't effect anything when it opens/closes and by default the display is none. This all works great with the ".show()" effect except for the queueing issue.
How can ignore queuing in mouseover/mouseout in such codes like this:
I dont want cubes blink N times when the user does mouseover/out N times.
I dedicated some time creating my own carousel with images, and got a little problem:
It works perfectly when I´m on the website, but when I change between the tabs on firefox/chrome, it seems that the function make some kind of queue, and when I come back to the website, it execute the function a lot of times at the same times, passing between the images in less than half second (I configured to change every 5 seconds).
function circCar (car) {
Here is the code, and if anybody wants to see the problem, open this url, open another tab (blank or another website) and stay on it about 15 seconds, when you come back to my site, you will see the queued function. [url]
I have a simple navigation system, and I am using hover, to show/hide details, but if I hover back and forth too fast between the elements, the animation queues up and keeps executing even when I am not hovering over them.
[Code]...
I can use stop() on animate to prevent queuing, but doing it like in the code above, stops the animation from even happening. Please suggest a solution.
I've been stumped. I'm usually good at figuring this stuff out, but I'm completely confounded here.I have a form with tables in it to add items to a series. The rows are being added dynamically by Jquery on the click event.
$('#add_hybrid').click(function(){
$('#hybrid tr:last').after('<tr><td width="15%"><?=brands('hybrid');?><input name="clubtypes[]" value="6" type="hidden" /></td><td width="25%"><?
[code]....
I am using jquery with the cookie plugin and I have multiple image buttons that can hide/show multiple elements. My question is how can I add a cookie to this code to remember whether each separate element is opened or closed?
The code,
$(document).ready(function() {
// choose text for the show/hide link - can contain HTML (e.g. an image)
var showText='<div class="expanddown"></div>';
var hideText='<div class="expandup"></div>';
// initialise the visibility check
var is_visible = false;
// append show/hide links to the element directly preceding the element with a class of "toggle"
$('.toggle').prev().append('<a href="#" class="togglelink">'+hideText+'</a>');
// capture clicks on the toggle links
$('a.togglelink').click(function() {
// switch visibility
is_visible = !is_visible;
// change the link depending on whether the element is shown or hidden
$(this).html( (!is_visible) ? hideText : showText);
// toggle the display - uncomment the next line for a basic "accordion" style
//$('.toggle').hide();$('a.toggleLink').html(showText);
$(this).parent().next('.toggle').slideToggle('fast');
// return false so any link destination is not followed
return false;
});
});
HTML,
<a class="togglelink" href="#"></a>
<div class="toggle">
Content
</div>
I'm trying to search for the correct code to make my form work. I have 3 select boxes - one with 2 options, one with 8 options, and the last with 2 options... All of this adds up to 32 different url paths. Can anyone tell me how to get this done?This is what I have so far: (and yea, I know I suck... I honestly have absolutely NO clue)
<html>
<head>
<script>
[code]....
This is my first post to this forum. When a button in parent window is clicked multiple times, more than one popup window is opened. This problem is occurring in linux firefox and mozilla browsers. In windows the code is working fine. Is there any option in window.open() method to open a popup window once. s there any known issue regarding this case?. Need a workaround to fix this issue.
View 1 Replies View Relatedhen a button in parent window is clicked multiple times, more than one child window is opened. This problem is occurring in linux. In windows the code is working fine. Is there any option in window.open() method to open a child window once.
View 8 Replies View RelatedI am trying to change each forms .submit function like so (below) but each submit button gets the function of the last iteration. I want each form to have a different submit function without using onclick events.
var x = document.getElementsByTagName("form");
for(i=0; i < x.length; i++){
var ele = x[i].elements;[code].....
I am setting up a text search with 3 search buttons to allow 3 different searches from the one text box. Each search has different values for the 2 hidden elements. So far I've got the 3 submit buttons working with the below code but I can't figure how to get the hidden values to be inserted. For each of the 3 different submits I need to tell javascript what the 2 hidden values are.
<SCRIPT language="JavaScript">
function OnSubmitForm()
{
if(document.pressed == 'questions')
{
[Code]....
Does anyone know of a Javascript slider that can function like Adobe's gradient creator?I'm not actually making gradients, I just need similar slider capabilities.I have a defined date range, let's say it's January 1 to Januaray 31. I want to make a slider that allows my user to split this date range into multiple ranges. So one person can do:
Jan 1 to Jan 5, Jan 6 to Jan 12, Jan 13 to Jan 31 Another person can do: Jan 1 to Jan 21, Jan 22 to Jan 31. How many regions they create doesn't matter to me. The goal is to pull it off with a Javascript slider that works similar to Adobe's gradient creator. Handle's can be added by clicking and removed by pulling it away from the slider. Handle's can also slide around fairly liberally.
I am familiar with the user built addEvent function used to load multiple functions in the window.onload property. However, I am curious as to the best way to do this across multiple JavaScript files. I thought I had seen somewhere code similar to the addEvent function was native to JavaScript now but I can't seem to find that anywhere.
Just to clarify, suppose I have 3 JavaScript files:
Code:
function foo() {
// do something here
}
fileB
[Code]....
note that it is not feasible to combine those functions into one file as they aren't always loaded together. What's the best way to load them all as a window.load?
how to assign multiple action with multiple submit button in the form.
View 2 Replies View RelatedProblem: This is essentially for a model number decoder. Several selection boxes full of coded information in a left column, decoded items appearing in right column. The 'decoded' divs will only show up when their coded counterparts are selected in the dropdown. The main problem is that I know nothing of Javascript.I have cobbled together enough stuff to get the "select box 1" to toggle the corresponding div, but have no clue how to get the next in series to toggle the next div. CSS:
HTML Code:
.col1 {
float:left;
[code]....
I have found a problem with <select multiple="multiple"> and .change() under ie6. The problem is ie6 fires first change event right after any other event, like selecting again, clicking mouse, pressing a key etc. It is perfectly seen on [URL]... Just click any option in demo, nothing will happen.
If i put a handler using plain DOM, i.e. $("select").get(0).onchange = function() { ... } the problem dissapears. So, it's definitely a bug with jquery. JQuery version 1.4.2.
How to read multiple id's in a table. I would like to change font color depending on id. Is it possible?
document.getElementsByName() doesn't work in mozilla.
I am trying to introduce a multiple datepicker into a webpage and the
problem arises with the second picker. I tried to copy and adapt the code I
employed for the first one, renaming the variables but it is simply unable
to output any date to the database. The code for the first picker (which
works fine) is as follows:
in some of my pages i use several files .js, and i wanted to know how
to get the highest performance:
- Joint all my .js in just one, so the http request nonpersistant get
very accelerated
- One file per script, so in many pages i only download the ones that i
use
I want to return one of several values, based on the value of a variable.
Is there a compact way to write this? Something like:
var J=5;
var K= {"One","Two","Three","Four","Five","Six"} [J];
.... so K would hold "Five" in this case.
I have a script that is called by the window.onresize event. The
problem is that the script is called multiple times when I'm resizing
the window in IE - obviously, because IE continuously fires the
onresize event while it is being resized.
What I'm wondering is - does anyone have any suggestions on making the
script function only once, after the last onresize event, rather than
on every one?
I've done some searching, but I'm not getting much - probably because
I'm having trouble finding a good phrasing for the search.
I'm my script I've three loops processing a very huge data file. IE & Firefox show a message box after some time saying my script could be infinite looping and give me a chance to stop it.
Is there a way to prevent this dialog box to show up? I'm writing a script used only on a intranet and the final customer should not see the message box.
I have (as an example) an array of values as follows:
arrayvalues=new Array("0001","0003","0005") where each is the value
of an option in a select statement:
<select id="usertypes" multiple="multiple">
<option value="0033">data1</option>
<option value="0025">data2</option>
<option value="0001">data3</option>
<option value="0003">data4</option>
<option value="1234">data5</option>
<option value="0005">data6</option>
</select>
Based on my array values I would like to highlight each option whose
value cooresponds to an element of my array. I have the following
javascript code:
usertypes=document.getElementById("usertypes");
for(var j=0; j<arrayvalues.length; j++)
for(var i=0; i<usertypes.options.length; i++)
{
if(usertypes.options[i].value==arrayvalues[j])
usertypes.options[i].selected=true;
}
Problem: Script will not highlight all options associated with my
array values. However, if I add an alert statement before or after
the if statement, the script will highlight each entry as needed.
Does anyone have any ideas on why this is happening?
Code:
Currently, I have one of the iframes working. When you click on it text
below appears with information about the jewelry.
I would like an iframe to open up (immediately to the left of the
image) and show an enlarged image of the thumbnail (yes I know right
now the images are not thumbnails, but my friends are working on the
graphics).