I have a search function which works when I only want to have only one search per page, but as it involves a string call I'm not sure how to modify it to multiple search requests on a page.
The below works fine for one call:
<script type="text/javascript">
function showHint(str){
if (str.length==0){
[code]...
The above doesn't work and I am not sure what do about the showHint(str) as clearly I am not representing it properly in my attempt to modify the script.
I'm trying to in make in a single function, multiple calls to the same file changing one parameter the problem is thatit is taking it like if I wasn't changing the parameter and is sending only the last value all the times.Here is my code:
$(function(){ $('#btn_search').click(function(){ // what to search for
question: when i quickly move the mouse from one image to the other shouldn't i see one expand and one shrink simultaneously? i am currently seeing one shrink, then the other expand after. on occasion the shrink is skipped and the next image is expanded right away.
I am trying to populate two select boxes with over hundred option elements for each. I have succeded in doing so but with a little problem. I make two xmlhttp calls one after another. What happens is that if the first call doesn't make it before the second, the data in the first select box fails to load and the second box succesfully loads data. I am new to the Ajax world but i am sure i am not doing it right.
Basically, what I am trying to do is call several ajax requests using jQuery on the same page, i know that all browsers are capable of requesting multiple requests. However in Chrome and Safari my website works fine, but IE, Firefox and Opera all only call the first request then dont call, the second two. I dont know why though?
I'm using jQuery 1.4 to hide a div (#cartPop) when the "close" link inside of it (#cartPop a) is clicked. Since I'm using animate() to fade the div out (opacity), I also have to use hide() to get rid of the div once it has faded out (otherwise the invisible div, which is on a higher z-index, blocks the elements on a lower z-index).
Code:
The problem is that the hide() function calls immediately without waiting for the animate() function to run. Even if I append a delay() function before hide() like so:
I'm developing an asp.net MVC app, and decided to take advantage of JQuery's great datepicker using the following code in my master page:
[Code]...
My problem is that the alert block of code never fires. When I change it to occur before the datepicker code, the alert fires but the datepicker part won't work. What am I doing wrong here?
I have several ajax calls that originates from the same page its updating. It works perfectly in firefox but in IE it works for about 18 requests and then just stops until the page is refreshed. I thought it was a cashe issue but I have added a variable for that. I think it may have something to do with binding but I am not sure how to sort that. This is one of my functions.
I'm trying to make a little loop that in each itteration executes a little php script to send mail with the mail() function. the php script returns either succes or failure. Now its my intention to append that msg to a div, after every execution.
the show status(result) is nothing more then a .append(result) the zenMails(y) calls this function again to send the next mail. It does work though but it only updates the div after the entire loop is done, i 'ld think it ld do so after every execution since i call the showstatus when the synchronous call is done and only after that i call the next iteration. Is there anyway to work aroud this ? (making the call assync doesnt work , because the port for sending the mail would still be in use)
I want to send another ajax request when one request is in process to get the status of first request. If I call both the request the second request gets blocked till the completion of the first request.
The javascript function addRowToTable() is called by a button, and replies a set of elements (select, input, checkbox) of the form. In this function, the creation of select calls another function CliK(sel.id)The problem is that this function tells me error "object required" as if the select Id was not "type" or the checkbox id was not "key" here I go wrong?
function addRowToTable() { var tbl = document.getElementById('tblSample');
My problem is that some of these myFunction#s include AJAX calls but the calls depend on each other in such a way that myFunction2 will not work unless myFunction1 has completed. So what is the "nicest" way to make sure of this? I've considered putting a hidden element in the HTML and then changing it at the end of each function call and have the onchange event trigger the next function call. But this seems very hacky and overcomplicated - surely there must be a simpler and better way....?
I'm trying to build a page that has multiple ajax calls on it. When you do it the old-fashioned way with XmlHttpRequest, you'd create a new xhr object for every call so that they execute simultaneously. If I try to do this in jquery it will only execute a call when the previous one has completed. This makes the page load time completely unacceptable. How to improve the performance?
I am working on a project that relies heavily on AJAX calls, they are done in dozens of places. There are a number of places where I would want to prevent the user from submitting information multiple times (form submissions etc ). I am trying to think of the best way to accomplish this.
I could simply disable the element that starts the AJAX call upon the first click and re-enable it upon completion of the call. I have also seen examples of developers using a class to handle ajax calls that store an identifier for the call and if it is in progress any new calls with the same identifier will be ignored.
I would like to add dynamic text sizing to a website. There will be three text sizes. When the default is used, only the "Increase text size" button is shown. When the maximum size is used, only the "Decrease text size" button is shown. And otherwise, both buttons are shown.
I've been working on a mockup as follows at the end, but my issue is that once I have manipulated an element of the HTML DOM, if I access it again to check it's value, I will only get the original value in the document. To do the dynamic buttons, I need to maintain some kind of state between function calls, so that I know what the current size is. Can I even do this with Javascript or am I barking up the wrong tree?
I am creating a JavaScript object which I want to use to respond to user input on a web page. The object will basically be made up of a constructor and then a selection of functions which will use the DOM to alter the appearance of the page according to the user's input. I am getting stuck because I want a form element that is being created by the object to have an 'onkeyup' event attached to it which will call another function from the same object.
Now, I understand how to attach the 'onkeyup' event to the input element I have created using the DOM. If I tell the event to call a normal function (alert() etc) then it does exactly that. What I am having trouble with is getting the event to call another function from the object that created the input box in the first place. (I don't even know if this is possible / a wise thing to do!). Code:
Two calls, one from a form and one from the html body reach the same 'window.open' function but only the former works.
The idea behind the simplified script of my post is to select to open one of two windows (files) by pressing one of two buttons. Each button passes a different parameter to the 'open/focus' window function. This function has an argument(arg) place holder to determine which window(file) to open(or focus) when a button is pushed and a corresponding string(argument) is passed. The window function is simply a double function,repeating the same if-else statements. That is, with the function(arg): "if(if-else) else(if-else)", the argument passed to 'arg' will determine if[to] {open else focus file1(button1)} else[to] {open else focus file2(button2)} in a new window.
Using a PC with either Explorer or Firefox, both the form button and the button coded in the html body opened a new window, but only the form button could bring the window forward(via 'object.focus') if it was already open. Using a Mac with Firefox, the form button worked well either to open or to bring forward an existing window, but the the button coded in the html body did nothing. Two 'alert' are place in the window function to show that the html button's call is reaching the window function. My question is that if this call from the html button passes through the same statements as that of the form button, why does it fail? (The script is in Perl, but it can be viewed as html in the source page.)
PHP Code:
#!/usr/bin/perl -w use CGI qw(:standard);use CGI::Carp qw(fatalsToBrowser);use strict; my $query = new CGI; my $JSCRIPT=<<EOF;
I am currently trying to make an html link that will add elements (specifically, drop down menus) to the current page when you click it. Since I am adding all the elements to the page using JavaScript, I'm not sure how to set up the link to call a function rather than go to a different page. I've seen people set the href attribute to the function they want, so I tried that and it didn't work. I've also seen a way that involves using onclick and making the link follow the onclick, not go to a different page.
In summary, how do you create/edit a link (from javascript) to make it use a javascript function rather than go to a different page? This is what I have currently (that concerns the link):
var link = document.createElement('a'); eval("link.setAttribute('href', 'javascript:addHours(" + dayDiv + ")');");
I have some javascript the works in conjunction with a flash video player. When a user selects a video in the Flash video list and new video is called and begins to play. Also, when that video is selected a function called "doOnMediaLoad()" is called and inside of that function I have put a call to another function that I wrote in the same script.function that is called when user selects flash player video list.
function doOnMediaLoad(e) { vcomments_changed(e.id); //call to my function }
I have some javascript the works in conjunction with a flash video player. When a user selects a video in the Flash video list and new video is called and begins to play. Also, when that video is selected a function called "doOnMediaLoad()" is called and inside of that function I have put a call to another function that I wrote in the same script.
I am trying to call a dynamically chosen function on success from an ajax call (later to be error and so on also)The following function works fine and passes the url to call and parameters into the makeAjaxPostCall function. successHandler is the function to call on ajax success.[code]
I need to have a select menu reset to its default option (the one with a value of "0") when a user types in a text field. Check out the code...the html:
I have below code to create two ajax requests. When ajax requests fetched, they alert the related request number.
Code JavaScript: function ajaxIt(url,num){ var req = new XMLHttpRequest();[code]....
why removing var phrase overwrites requestNum value for two different asynchronous functions? How can I make sure variables are not overwritten by different function calls?