Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Change page content with AJAX: Cannot set property 'innerHTML' of null

2 replies [Last post]
Reply

Hello,

First, I would like to say that this solution is a pleasure to use. Great work, thank you.

Here is my issue:
I use jQuery to update the content of a page dynamically. Part of the content that get updated is my <script> tag containing the url to my BOTR player (url I craft dynamically to point to the right video).

After the reload, it looks like jQuery is re-executing the <script> tag correctly, however, the Javascript code is failing. I got this error (pulled from the "chrome console"):

Uncaught TypeError: Cannot set property 'innerHTML' of null
botrObject.writePlayerdGKGYU1O-J8qoPyQ5.js:5
(anonymous function)

I thought that maybe, the javascript object was still containing an old reference to the previous content, so I tried to set it to null after my call return from jQuery. I got another error in this case, it looks like it's going further though.

Uncaught TypeError: Cannot read property 'swf' of null
(anonymous function)

It fails at this line:
var botr_UYiuQMD2_J8qoPyQ5 = new botrObject.swf(

I guess it's because the object has been set to null, but as per what's above it:
if(typeof(botrObject)=="undefined"){var botrObject={} [...]
I thought the object would have been recreated as it is set to undefined ...

I spent quite some time on this. Hopefully you guys could give me a hand.

Thanks a lot.

Reply

Unfortunately, there's still an issue with our <script> players that prevents them from easy AJAX loading. See more info around this here:

http://www.longtailvideo.com/support/bits-on-the-run/23360/embedding-best-practices

We are looking into making the <script> tags work with AJAX too, but this requires an update of our scripts that subsequently requires an account-by-account migration. We will do this over time, but for now it's best to stick with the <iframe> embed method if you want AJAX player reloads.

Reply

Thanks, it now works.

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options