View Full Version : Running ASP files in Ajax Tabs Content script

04-29-2007, 07:25 AM
1) Script Title: Ajax Tabs Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem:

I am sure there is an easy explaination for this but I cannot find the answer to it. I am trying to run .asp files inside the list items below. It works if I rename the files to .htm but the asp code does not run accordingly. Can someone please advise me on how I can run .asp files as content within Ajax Tab's?

<ul id="maintab" class="shadetabs">
<li class="selected"><a href="representative.asp" rel="ajaxcontentarea">REPRESENTATIVE</a></li>
<li><a href="customer.asp" rel="ajaxcontentarea">CUSTOMER</a></li>
<li><a href="freetrial.asp" rel="ajaxcontentarea">FREE TRIAL</a></li>

<div id="ajaxcontentarea" class="contentstyle">

<script type="text/javascript" language="Javascript">
//Start Ajax tabs script for UL with id="maintab" Separate multiple ids each with a comma.

I found this comment (below) from one of the other members on this site in regards to this but can't quite get the gist of it:

"You cannot include PHP code in an HTML document (with the extension .html, unless you have the MIME type set as application/x-httpd-php). The AJAX can call any type of web document (such as PHP, ASP, Perl, XML, HTML, etc) as long as the page exists on the server."

I would appreciate any help you good people can offer.

Thanks in advance.

04-29-2007, 08:37 AM
As far as I know, there really is no rule on this. In general, the server should serve the .asp page processing the asp code on it into HTML which the script would then receive from the request object and write to the target division on the 'top' page.

If the generated HTML of the asp page, once served, is invalid, that will often cause problems*. You can check that by viewing the external .asp file alone in the browser and validating it. If there are errors, these should be able to be fixed by modifying the .asp page.

However, any given server running any given version of asp might not work out like that even though most will.

If you also have client side VB or javascript on the external asp page, that may create other problems. Retrieval of includes must be absolute or relative to the top page. Any values retrieved from the server must be up to date at the time they are sought.

*This is especially true because the browser will need to parse it twice as HTML. Once while writing via the browser's javascript interpreter as the innerHTML property of the target element and a second time as HTML code. This has a tendency to magnify errors and often overcomes a browser's error correcting algorithms.

04-30-2007, 01:33 AM
Thank you John,

The problem was the <!--#include... files that were outside of the .asp files. They work like a dream now once I include them in ajax content files.

Much appreciated.:)

05-11-2007, 12:23 PM
Hi i am a newbie with asp and i am having the same problem with the Ajax tabs content. I was hoping you could explain how you used the <!--#include to solve the problem i.e. where and how you used it. Your help would be really appreciated Thanks James