/    Sign up×
Community /Pin to ProfileBookmark

Is dynamic javascripting buggy with Ajax & ASP?

Hello,
I am new to web programming & developing, so please bear with me.

I have figured out how to dynamically load external javascripts after an Ajax call via this code: (Thanks to this forum)

[CODE]
var script1 = document.createElement(“script”);
script1.src = “somefolder/somescript.js”;
script1.type = “text/javascript”;
script1.language = “javascript”;
[/CODE]

I have gotten this to work on my Ajax pages that call php pages, but I am now trying to call an ASP classic page and there is one line one of the scripts that is not executing.

The asp page builds a menu-like structure of unsorted lists that are supposed to initialize collapsed. This is where the scripts come in. They also add the functions to change the mouse pointer, and add onclick functions.

The rest of the functions work, but the very first one, the one that initially collapses everything gets skipped.

3 scripts get dynamically loaded. jquery, jquery.color, and finally the one that triggers everything ‘formatmenu.js’

it’s code:

[CODE]
$(function() {

// hide all the sub-menus
$(“span.toggle”).next().hide(); <- This line gets skipped

// set the cursor of the toggling span elements
$(“span.toggle”).css(“cursor”, “pointer”);

// prepend a plus sign to signify that the sub-menus aren’t expanded
$(“span.toggle”).prepend(“+ “);

// add a click function that toggles the sub-menu when the corresponding
// span element is clicked
$(“span.toggle”).click(function() {
$(this).next().toggle(1000);

// switch the plus to a minus sign or vice-versa
var v = $(this).html().substring( 0, 1 );
if ( v == “+” )
$(this).html( “-” + $(this).html().substring( 1 ) );
else if ( v == “-” )
$(this).html( “+” + $(this).html().substring( 1 ) );
});
});
[/CODE]

This may not be because it is ASP, but that is the only difference I can narrow down between working and not working.

Any help is appreciated!
Thanks

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @magnadyne 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...