Ajax :: Initiate Calls Without Page Reload?

Oct 29, 2010

I have a ajax function implementation: when the user is on one site, the ajax call keeps checking the server every 5 seconds if there is a server url change. If there is, there will be a message displayed to direct the user to go to another site.

when the user go to another site, the ajax keeps checking every 10 seconds, if there is condition met, the message will be displayed to direct user to go back to the previous site. Also, after the message is displayed, ajax call keeps checking if there is another condition met, if there is, the message will automatically disappear.

The use case is: when one server is down, the message will direct the user to another site. On another site, when the previous server is up, the user could be redirected to the previous site. there is also scenario that when the message is displayed (when server is down), the user may not follow the link to do anything. he/she may simply leave the message on and go to lunch or something, when he/she comes back, the server may be already up and the message should be disappeared instead of keeping showing the message. Therefore, the message should be displayed or disappeared automatically based on the ajax call condition.

I implemented the ajax function and it did check and displayed message. However, it wont' display the message only until the user login or the user does a "refresh" to the page. After the message is displayed, when another condition met, the message won't disappear until the page is refreshed. Then the ajax calls keep doing fine every 10 seconds. The ajax call seems fine since when I set a alert, I did see the popup message show up every 10 seconds (but only after I refreshed the page.)

Now the problem is: the message can't be automatically displayed or disappeared. It can only happen when there is new page load (refresh). How can I solve this problem. I'm thinking of putting "windows.location.reload;" to load the page right after the condition met. But kind of feel I don't need to do this.

View 3 Replies


ADVERTISEMENT

AJAX :: Functions Never Work With PHP - Tree Folder Which Calls Another Page To Be Loaded Into A DIV By AJAX Again

Apr 14, 2009

I'm creating an AJAX page that is built using a PHP Class, ie the php looks a bit like this: PHP Code:

$wp_page->addjs('../var/savepolicies.js')
$wp_parser->page = "userpolicywindow.php";
$wp_parser->addlink("Home","../index.php","");
$wp_parser->addlink("Logout","javascript:logout();","");
$wp_parser->getpageid("501");
[Code]...

within this page that has been created, there is an AJAX tree folder which calls another page to be loaded into a DIV by AJAX again. Code:

[Code]...

I don't know why it doesn't work because the page has been loaded with the JS file, but as soon as the link is added afterwards it doesn't work. I take it this is because it doesn't know where to find the JS, but how can I overcome this?

View 4 Replies View Related

JQuery :: Initiate Ajax Get When User Fills Textbox And Clicks Off

Apr 7, 2011

I've been reading about jquery and ajax and I'm not exactly 100% sure as to how to implement it. Essentially I have the following:
A textbox
A select box
Another select box

As the user fills data in the textbox and then clicks off I want the javascript to fire, submit the value in the textbox to a url (I can handle the backend side of it all fine) which will then send new data to the select boxes. Similarly for the second select box when a user clicks off (After selecting) I need the jquery to fire again. I've seen this code and think I get how to write it in, but I'm not sure how to do the (When user clicks off bit of it).
$.get('ajax/test.html', function(data) {
$('.result').html(data);
alert('Load was performed.');
});

View 1 Replies View Related

JQuery :: Multiple Ajax Calls On One Page?

Jan 12, 2011

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?

All of the code for the site is here: [URL]

View 5 Replies View Related

Ajax :: Multiple Calls Same Page Stops Working IE?

Aug 16, 2011

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.

[Code]....

View 3 Replies View Related

Body Onunload Event - Initiate Fancybox Popup On Page Unload

Feb 17, 2011

I am trying to initiate fancybox popup on page unload (i.e. when the user closes the browser window). I managed to find the following script which does the opposite (launches when the page loads). How can I reverse this code so that it executes on body unload?

[Code]....

View 5 Replies View Related

Ajax :: Reload Everything In A Page Except For An Iframe

May 6, 2009

I have the script below (lend by one of the geniuses of this wonderful community) and as you'll see it reloads the page products.php every 3 seconds without any visitor noticing it. Simply wonderful.

Now the problem: products.php contains divs with information, but it also contains an iframe. The iframe is calling an URL that displays videos.

When products.php is reloaded the information changes (is coming from a xml file) and the iframe contents are also reloaded which causes the video stream to blink every 3 seconds. Therefore, the iframe should not be reloaded. What can I do, how should I modify the script to reload everything inside of products.php but the iframe??

Code:

<script type="text/javascript">
function getHTTPObject() {
var request = false;
try {

[Code].....

View 1 Replies View Related

Ajax :: Call Without Page Reload?

Oct 28, 2010

I have a ajax function implementation: when the user is on one site, the ajax call keeps checking the server every 5 seconds if there is a server url change. If there is, there will be a message displayed to direct the user to go to another site. when the user go to another site, the ajax keeps checking every 10 seconds, if there is condition met, the message will be displayed to direct user to go back to the previous site. Also, after the message is displayed, ajax call keeps checking if there is another condition met, if there is, the message will automatically disappear.

The use case is: when one server is down, the message will direct the user to another site. On another site, when the previous server is up, the user could be redirected to the previous site. When the message is displayed (when server is down), the user may not follow the link to do anything. He/she may simply leave the message on and go to lunch or something, when he/she comes back, the server may be already up and the message should be disappeared instead of keeping showing the message. Therefore, the message should be displayed or disappeared automatically based on the ajax call condition.

I implemented the ajax function and it did check and displayed message. However, it wont' display the message only right after the user login or the user does a "refresh" to the page. After the message is displayed, when another condition met, the message won't disappear until the page is refreshed. Then the ajax calls keep doing every 10 seconds. The ajax call seems fine since when I set a alert, I did see the popup message show up every 10 seconds (but only after I refreshed the page.) Now the problem is: the message can't be automatically displayed. It can only happen when there is new page load (refresh). How can I solve this problem. I'm thinking of putting "windows.location.reload;" to load the page right after the condition met. But kind of feel I don't need to do this.

View 5 Replies View Related

AJAX :: To PHP Post With Page Reload?

Aug 23, 2010

Code:
$(document).ready(function() {
$('#save_editable').click(function() {

[code].....

View 2 Replies View Related

Jquery :: Ajax Prevent Page Reload?

Sep 10, 2010

i can't figure this out, it was working fine before, and i did a few updates and now it only works when the button is pressed but not if i type into the form and press 'enter'. i don't want he page to reload at all. (also the entire wrapper for my page is hidden using css, a loading image is displayed until the onload event fires, then the wrapper uses jQuery's .slideDown(2000), so if javascript is off they won't even see the form, i'm not concerned about browsers with javascript disabled, i *only* want them to be able to type in the field and hit enter or click the send button to post the data via ajax with no page reload. i'll make it more accessible later)

[Code]...

View 1 Replies View Related

AJAX :: Script Causing Automatic Page Reload?

Jun 8, 2009

I'm writing a script, part of which calls an AJAX request to populate a table. This script runs when the page is first loaded and when different buttons are clicked on the page (I won't go into the details here). It works just fine when the page is first loaded, but whenever the function is called from any other event on the page (onclick, etc) it performs the function, but then proceeds to reload the whole page!

I've spent a long time debugging and trying to figure out exactly where the trouble is starting, and the only thing I can think is that some sort of "reload page" command is being sent to the browser somewhere that I'm not seeing. In Firefox, after the request is complete and the response data is written to the page, the page reloads. However, in Safari, the page reloads after the readyState is 1, so the request hasn't even been sent yet.

Here is the offending function:

Javascript Code:

function fillLogTable(date, org, poc, name)
{
document.getElementById("visitLogTableDiv").innerHTML = "<br />Loading...";
//fetch the logs

[Code]....

View 2 Replies View Related

JQuery :: Reload A Page With Ajax In 5 Seconds Passing GET Variables?

Oct 7, 2011

I'm reloading a div of a page using jQuery, but i need that every time that reloads (it reloads automatically every 10 seconds) obtains the get variables that i passed through the address bar

View 4 Replies View Related

JQuery :: Reload Function After Ajax Reload

Oct 27, 2011

I have a simple product display with an product image. The product image changes with ajax when i click in a dropdown menu on another color.

Now i added the (beautiful) zoom script cloud zoom. It just works fine but after i click on another color and the product image reloads the script does not work anymore. instead my <a> is just a normal <a>.

This is the part that reloads at all:

How can i reload the function when this part reloads? Or what else could i do?

View 2 Replies View Related

JQuery :: Ajax Calls Works, But Only On Second Try

Jul 19, 2010

I'm trying to use the jqmodal dialog plugin and everything is working OK except for one minor problem. It seems when I click on the link, the expected action does not occur until I click the second time. Essentially I set up a small test form with a single line put into a table. In that data line is an href, which when clicked calls an AJAX function and returns text, which displays as a dialog. Like I said, this works fine except for the fact that the dialog does not show until the second time I click on the link. I added an alert box to the code, so I know the function is executed the first time the link is clicked

<script>
$().ready(function() {
$("#hrefClick").click(function(e) {
e.preventDefault();

[Code]....

View 1 Replies View Related

JQuery :: Enqueue A Set Of Ajax Calls?

Nov 22, 2011

I've a js with a loop wich generate ten ajax calls, but I aboslutely need that the first will be executed before the others. how to ?

View 5 Replies View Related

AJAX :: Facebook Login With Calls?

May 4, 2011

Below I have a facebook login/logout script for my website. The login works fine. The AJAX requests the php file, waits for the "Success" response, and then reloads the page. The logout doesn't. Instead the browser goes to the PHP file with just the word "Success" printed on it. I've separated the xml request as a separate function but that doesn't appear to solve it either. code...

View 1 Replies View Related

Ajax :: Calls Not Being Made After First One / Sort It?

Jun 29, 2009

Okay, I am in the process of making an Ajax library for jBeta, and have run into a snag. code..

NOTE - I have stripped everything not-necessary for this code out. If you want to have the rest for testing it can b downloaded from the jBeta project thread in the projects forum (everything is the same except for this Ajax stuff, which I am adding).

Now, as you can tell the two calls are the same. The first one returns fairly quickly, but the second one never returns, and I haven't got a clue as to why (it is late, so I may have missed something). What should be happening here, is that you can have 1 Ajax call going at a time (I know the limit is 2, this is just for dev purposes), when you get multiple calls all the subsequent ones should be added to a queue and then the library should get to them in order (seems to work, it calls the call() function 3 times). For some reason the later calls (after the first one) are never made (I am assuming that is the problem, they should return if they are successfully sent, one would think).

View 11 Replies View Related

AJAX :: Reducing The Number Of Calls?

Aug 15, 2011

I have a search box which uses AJAX to query a database and return a list of suggestions to the user, it works off the "onkeyup" event on the input textbox.

Code:

<input type="text" id="txt1" onkeyup="showHint(this.value)" />

Obviously this creates an AJAX call for every keypress the user makes and I'd like to make this more efficient by adding a short delay before the AJAX call is made.

View 13 Replies View Related

Interval Between Two Consequetive AJAX Calls

May 2, 2007

In my js application, consecutive ajax calls are made while running in a for loop. I am using prototype.js for AJAX calls. now if I don't call any function on onComplete event then everything is ok. but if I do so, then the function I have set in an onComplete event is invoked once or twice. rest of the time it doesn't work. the code is like the follwing:

/**
* Moves selected options from source to destination select list.
* @param source select list, destination select list
* @return none
*/
function moveMultipleOption(sourceListId, destListId)// single or multiple based on selection
{

var sourceListBox = document.getElementById(sourceListId);
var destListBox = document.getElementById(destListId);

var sourceTableName ;
var destTableName;

if(sourceListId == 'firstList')
{
sourceTableName = "left_table";
destTableName = "right_table";
}

if(sourceListId == 'secondList')
{
sourceTableName = "right_table";
destTableName = "left_table";
}



for(i = sourceListBox.options.length-1; i>=0; i--)
{
//for() loop is used for finding how many options are selected.
if(sourceListBox.options[i].selected)
{

addOption(destListBox, sourceListBox.options[i].text, sourceListBox.options[i].value);
sourceListBox.options[i].selected = false;

AjaxRequest(sourceListBox.options[i].value,sourceListBox.options[i].text,sourceTableName,destTableName);
}
}

}
/**
* Calls to server through Ajax
* @param option value, option text, source table name and destination table name.
* @return none
*/
function AjaxRequest(i,textValue,sourceTableName,destTableName)
{
var url = '/run.php/SelectList'
var pars = 'cmd=singleTransfer' + '&itemValue=' + i + '&textValue=' + textValue + '&sourceTableName=' + sourceTableName + '&destTableName=' + destTableName;

var myAjax = new Ajax.Request(
url,
{
method: 'get',
parameters: pars,
onComplete: showResponse
}
);
}

function showResponse(originalRequest)
{
// CODE IN THIS FUNCTION DOES NOT ALWAYS EXECUTE.
}

Now i have solved the problem for the time being by making a single call to ajax for the whole loop. Now my question is : what is causing this problem? Can I give time delays between two consecutive requests?

View 2 Replies View Related

JQuery :: Data Limit For $.ajax Calls?

Feb 27, 2010

I'm experiencing a weird problem when trying to do a $.ajax call. When I pass 5 variables, with either GET or POST, the script runs as I would like. However, when I use 6 or more variables, the script does not run. Does anyone know why this is?

Relevant code (stops1-5 are defined as JS variables earlier in my script, and the alerts are for testing)

$(".barcrawl-stop-id").each(function(){
alert("running ajax function");
$.ajax({
url: "/handlers/ajax/barcrawl_reorder.php",

[Code]....

So, the way it is now, it works fine (I get the first alert for each instance of .barcrawl-stop-id, and get an alert at the end with the returned data). However, when I add another variable to the data, like stop4: stop4, the script does not run (all I see is one alert with "running ajax function").

View 1 Replies View Related

JQuery :: AJAX Calls Acting Syncronously?

Aug 10, 2009

I am a newbie to using jquery and have been exploring it developing a new app. At the moment I have a number of AJAX calls to the server which I have been queueing in an array and using a single $.ajax call to handle all of them. However I know about the browser limitations of two calls per page (at the same time and want to implement this to speed up page updating). To test concurrent ajax requests I have setup various asp pages to with delays 1sec, 5sec, 10sec etc etc. and a test html file with the follwing javascript

[Code]...

View 4 Replies View Related

JQuery :: AJAX Calls To A Server On A Different Port?

Nov 3, 2010

I know about the same-origin policy and that one of the only ways to load data from a cross-domain is to load it as JSON. However, all I am trying to do is access data from a server on another port (which I believe the browser still treats as cross-domain). I need to do this because the server my application is on is a map server and the other server (Apache) is the only one that can handle php scripts. I have also tried out the plug-in from [URL] and while it works when I do $('#phpContent').load('http://www.google.com'); it doesn't work when I try $('#phpContent').load('http://localhost:80/mapScripts/getFiles.php'); I have also tried$.get('http://localhost:80/mapScripts/getFiles.php', function(data) { $('#phpContent').html(data); });

So here I am breaking my brain and do not know what else to attempt.

View 1 Replies View Related

JQuery :: Chaining AJAX Calls With Pause?

Aug 26, 2009

is there a possibility to chain AJAX Requests? By now i have 5 AJAX Functions where one calls the next (Button Click

View 2 Replies View Related

JQuery :: Slow Response To AJAX Calls In IE7?

Jul 30, 2009

I am developing quite a complex user interface in jQuery that relies on an AJAX call to retrieve JSON.We have noticed that the code runs slow in IE7. IE8 and IE6 are acceptable. Firefox and Chrome really quick. I have traced the problem back to the AJAX call, which IE7 seems slow o process. What takes less than a second in the other browsers will take IE7 3 or 4. I have googled for an answer it seems there is some consensus that the native XHR in IE7 is slow, so it may not be a specific jQuery problem.Has anyone else experienced this? Does anyone have a solution? Please consider that this will be a public website, so the solution cannot involve altering settings on users' machines.

View 5 Replies View Related

JQuery :: Memory Leaks With Ajax Calls?

Oct 27, 2010

I have a jquery based system with ajax calls instead of page refreshes. Every time I return some ajax content, it replaces the content on the main div.

function execcmdcallback(data, textStatus, XMLHttpRequest)
{
$("#divmain").html(data);
data = null;
}

Each time this executes, the browser memory increases by about 600-900kb. Can anyone suggest a way of doing this where the old memory is freed so there is no significant increase in browser memory on each ajax call ?

I've studied this a bit, [URL]..., but I have to admit I don't quite understand it I see the same issue on IE8, FF and Chrome. FF comsumes less memory per ajax call and frees some memory seconds later, but still the total working set is increasing on each call by 300k in FF and 600 to 900 in chrome and IE

View 15 Replies View Related

Double Ajax Calls, Using $F The Second Time Returns Null

Feb 11, 2006

I'm using the $F of the prototype library to send data through the Ajax
Request. I'm having problems using the $F to reference fields sent
back through an original Request. My first request sends a form back
to the user in the type such as <input text name=foo> and at the bottom
of the returned form I have a second ajax call to send the fresh data
to the another script. The problem is that the new data in the form
cannot be referenced from $F. My question is how can I pass the new
data in the javascript to another Ajax call either by $F or by other
means?

View 3 Replies View Related







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