473,507 Members | 8,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ajax Page Problem

384 Contributor
I have a page which loads the below code on a button click, if i access the page(ajax-150-null/) via its direct link the javascript function 'radio' works fine but if i click the button on the webpage the radio function doesn't seem to work?

N.B. - The forward slashes are there because its in a PHP function.
Expand|Select|Wrap|Line Numbers
  1. <div id="radio_wrapper">
  2.       <form>
  3.       <script src="../sys/js/radio.js" type="text/javascript">
  4.         radio(\'width\',\'450\',\'height\',\'120\',\'data\',\'http://raid.radiocrackle.com/3.swf\',\'type\',\'application/x-shockwave-flash\',\'src\',\'http://raid.radiocrackle.com/3\');
  5.       </script>
  6.       <noscript>
  7.         <object width="450" height="120" data="http://raid.radiocrackle.com/3.swf" type="application/x-shockwave-flash">
  8.           <param name="src" value="http://raid.radiocrackle.com/3.swf" />
  9.         </object>
  10.       </noscript>
  11.       <div id="radio_refresh_button_wrapper">
  12.         <input type="submit" value="Refresh Radio" onclick="getcontent(\'ajax-150-null/\',\'radio_wrapper\'); return false;"/>
  13.       </div>
  14.       </form>
  15.       </div>
Jun 11 '09 #1
3 1471
gits
5,390 Recognized Expert Moderator Expert
when loading something through ajax then the inculded javascript is not evaluated when you just add the content ... you would need to eval() the script part explicitly and then call the function when the call is successfully ready.

kind regards
Jun 12 '09 #2
ziycon
384 Contributor
I understand what your saying, not sure how i go about resolving the issue though?
Jun 15 '09 #3
acoder
16,027 Recognized Expert Moderator MVP
Separate the JavaScript from the HTML and either eval or add to the head (of the calling/parent page) via a script tag, e.g.
Expand|Select|Wrap|Line Numbers
  1. var script = document.createElement("script");
  2. script.type= "text/javascript";
  3. script.src = "src/to/js/file.js"
  4. document.getElementsByTagName("head")[0].appendChild(script);
I notice that you're mixing src and actual code together too. Separate that into:
Expand|Select|Wrap|Line Numbers
  1. <script src="../sys/js/radio.js" type="text/javascript"></script>
  2. <script type="text/javascript">
  3.     radio(\'width\',\'450\',\'height\',\'120\',\'data\',\'http://raid.radiocrackle.com/3.swf\',\'type\',\'application/x-shockwave-flash\',\'src\',\'http://raid.radiocrackle.com/3\');
  4. </script>
though in this case, it'd be better to put the radio() call in the same file or another file which you can reference easily.
Jun 16 '09 #4

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

Similar topics

5
1255
by: aroraamit81 | last post by:
I am using AJAX, it works very fine.............. But the problem is my back end aspx page does not get refreshed rather it picks old values now when I execute the aspx page explictly then the...
5
2198
by: Martin | last post by:
Hello NG, I've been doing some AJAX for a few weeks now. The basics worked fine so far, but now I've got the following problem which I can't solve: With AJAX you typically update/replace only...
9
2128
by: RBM007 | last post by:
Hello, I have created some pages in the (old) Atlas pages and migrated to AJAX version. After the update I noticed that any page containing ASP.NET AJAX won't compile anymore. Even if the same...
6
3068
by: Rob Meade | last post by:
Hi all, Looking for a bit of help if possible. For about 2 weeks now I've been investigating the best way to populate related drop down menus, and have their values pre-populated again if the...
6
5121
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
1
1819
by: violinandviola | last post by:
I have just put 4 different ajax bits on this page: http://jimpix.co.uk/default-ajax.asp The ajax spits out chunks of images / news content, and users can view the chunks via next / prev links....
2
1648
by: majidtou | last post by:
Hi , We have an HTML page which is using AJAX. We make an AJAX call which retrieves a table with mutiple rows. We need to extend this functionality. In the table, we want to put a button on each...
2
5519
by: =?Utf-8?B?REo=?= | last post by:
I have a peculiar problem here that I did not have until I migrated from ASP.NET 2.0 to 3.5. I use a master page for my application. Because the master page uses update panels I have the...
1
1351
by: EnjoyNews | last post by:
Hi I have a little problem with java ajax... On my site I have a google adsence placed in a list. After the first 10 records it shows a adsence commecial. But.. on my search page I use Ajax...
11
3011
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
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...
1
7023
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
7479
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.