473,395 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

delay execution of javascript function till php page finish executing

Shenno
59
hiz,

i got a problem that i need javascript function "ajax" to be execute after php page complete executing..

it's iframe page that uploads an image.. and the javascript function will load latest images...

i need after iframe php page uploaded the image, then javascript function be called..

anyone knows how to do this ?

thx in advance..
Sep 23 '11 #1
4 5239
Dormilich
8,658 Expert Mod 8TB
i got a problem that i need javascript function "ajax" to be execute after php page complete executing..
no problem. JavaScript (including AJAX) will always execute after PHP. so you might only need to delay the script execution until the website finished loading.
Sep 24 '11 #2
Shenno
59
i have 2 php files, 1st is iframe loading, the second contain javascript ajax..

javascript function on 2nd file called and executed while iframe php page is still loading...

that's my problem : /
Sep 24 '11 #3
johny10151981
1,059 1GB
you can follow two method,
1. after getting the text, extract the javascript part and then create a javascript node into main document. WHen you create the node and add the javascript code to the node it will execute the code and create all required function and variable.

2. you can do it using jquery. Jquery has developed all the way to extract javascript code and execute it in proper manner. here is a simple example how you can achive
Expand|Select|Wrap|Line Numbers
  1. $.ajax(
  2. {
  3. url: "target.ext", 
  4. type: 'POST', 
  5. dataType: 'html', 
  6. data: "Parameter1=data&Parameter2=data2", 
  7. timeout: 90000, 
  8. success: 
  9. function(retData)
  10. $("#MyProcessWindow").html(retData);
  11. }
  12. }
  13. );
  14. <div id='MyProcessWindow'></div>
  15.  
Sep 28 '11 #4
you can use the event onload on the iframe to run the JavaScript, e.g.
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function yourFunction()
  3. {
  4.   alert("Finished loading!");
  5. }
  6. </script>
  7. <iframe onload="yourFunction();" src="http://www.google.com"></iframe>
Oct 5 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Cristian | last post by:
Hi all, When I download a file with ftp_nb_get, I'd like to show the elapsed time and so I had insert this javascript function in my php page <SCRIPT> function scrivi(num, num2, num3) {...
4
by: cjl | last post by:
Hey all: I am preloading a large number of images for my web application, and I want to display something indicating progress. So I am simply swapping the visibility of an animated gif (which...
8
by: Jason Shohet | last post by:
Lets say I want a button to execute 10 seconds after I press it, not immediately. Any ideas how to cause that, in a code-behind. IMO its only server side code, I don't think javascript needs to...
5
by: DCC-700 | last post by:
I am using ASP.Net with VB on the 1.1 Framework running on Win XP Pro. I am trying to gauge the time it takes to sort a datagrid using different code sets. But when I am debugging the page there...
14
by: Rene Grothmann | last post by:
I have managed to communicate between forms and Java applets. A button press sends the content of the text area to an applet, a second button gets some text from the applet and puts it into the...
4
by: verci | last post by:
Hi guys, I'm running asp.net 2.0. Does anyone know how to fire or call a javascript function from inside my (VB.aspx) code without assigning it to a control attribute? thank you
2
by: gomzi | last post by:
hi, I would like to know as to how one could call a javascript function on page load. I would not like to call it through onload attribute that one can specify in the body because i am passing...
1
by: santhoskumara | last post by:
I am using Internet Explorer browser, I want to know how to clear cache and cookies using javascript function or java, when each time the page is loaded. i know to do manually in IE using TOOLS...
2
by: Mic | last post by:
Hi, How can I hide a button before executing a javascript function and make it visible again after execution of the javascript function? What I need to do is: VB Page_Load: 1) Hide...
5
by: =?Utf-8?B?TWF0Y29u?= | last post by:
Hello, I have a asp.net 2.0 (vb.net) page, which uses a master page, and there is a javascript function (myfunction) defined in the <headof that master page. Is there a way to run the function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.