473,661 Members | 2,429 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 1476
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
1259
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 out put on my page(where AJAX code has been written) gets reflected..... What could be done...... Any Idea...
5
2209
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 parts of your page. But in my application there are situation when I first notice on the server -- so AFTER sending an AJAX request -- that I have to update the complete page instead of only some parts. And what do I do now???
9
2136
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 tags and properties are used in a page without a masterpage. Does anyone shares this exprerience with me or does anyone knows an answer? For the time being, I copy-pased the headings in my masterpage to the clield pages.
6
3081
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 user clicks back with their selected options still selected - and I'm getting to the point where I might just popup a big window, perhaps with some flash in it and say "dont be lazy, select em again you great big freak of nature" because I am...
6
5141
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 application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
1
1834
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. When I first view the page in Firefox, there is a short delay while the content first loads in the ajax sections. When I first view the page in IE6, none of the ajax content appears to
2
1662
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 row. When this button is pressed, we want to update just the single row and keep the rest of the table the same. Currently the AJAX call looks something like this: document.getElementById("My_Div").innerHTML=xmlHttp.responseText; The server...
2
5529
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 scriptmanager control on the master page. Any pages in the app that uses the master page under 2.0 automatically used that script manager if any AJAX controls were involved. Everything was well with the world and we all sang ohmmmmmmmmmmmm.... After...
1
1359
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 to get the search result while you type the searchword. This works fine and a list is shown that matched the searchword.
11
3027
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 and IE8. There is no issue when the controls are allowed to complete loading. Can you please tell me the best practice that handles this? Thanks.
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
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 we have to send another system
2
1740
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.