/    Sign up×
Community /Pin to ProfileBookmark

include file using innerHTML

Hi,

Wanted to include ASP file in a div when a certain condition is passed in a javascript function using the innerHTML property.

Tried using the following but not working.

document.getElementById(“frame”).innerHTML=”<!–#include file=”/include/show.asp”–>”

Please suggest…

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@ZABIMar 07.2012 — ? FYI ASP is a server side language and run on server side. while JavaScript runs on client side.

why dont you try AJAX ?
Copy linkTweet thisAlerts:
@sameasinauthorMar 07.2012 — Thanks ZABI

I tried including a HTML page. No change...

DOM elements are supported with JavaScript and AJAX is an extension of the same. Correct me if I'm wrong
Copy linkTweet thisAlerts:
@ZABIMar 08.2012 — [B]AJAX[/B] = [B]A[/B]synchronous [B]J[/B]avaScript [B]a[/B]nd [B]X[/B]ML
Copy linkTweet thisAlerts:
@RodionGorkMar 08.2012 — ZABI means that you need to use ajax call in javascript which fetches text to be inserted from the server and when it is returned, you can place it into inner html. ASP scripts will not do since they are executed before browser gets the page and you could do with them nothing after page is loaded into browser (while javascript on contrary is working after loading).

Google for "ajax tutorial" and you in a few minutes will know what is it all about. Not too complicated trick, however.
×

Success!

Help @sameasin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...