2

url

http://localhost/news-events/news.html?file=hosted_service.pdf

Js code

parseURL : function() {
var _path = window.location.pathname;
console.log(_path);
var _locationSearch = location.search;
var _locationParse = _locationSearch.replace('?file=','');
console.log(_locationParse);
var filePath = "/pdffiles/"+_locationParse ; // /pdffiles/hosted_service.pdf
$('.divEmbed object').data(filePath); **How to set the data of object? this is wrong**
console.log(filePath);
}

Html

<div class="divEmbed">
                <object data="" type="application/pdf">
                    alt : It appears you don't have a PDF plugin for this browser.
                    Click <a href="">here</a> to Download the file.
                </object>
            </div>

What would the syntax be if i want to add the data of the object = filepath

1
  • $('.divEmbed object').attr('data', filePath);? Commented Mar 6, 2013 at 2:09

1 Answer 1

4

You're setting jQuery's data object, when in fact what you want is to change an ordinary attribute. Use this instead:

$('.divEmbed object').attr('data', filePath);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.