1
I need to upload the video.html page to div with video id using Javascript. I have the following script:
function video() { $.ajax({ url: "video.html", cache: false, success: function(html){ $("#video").html(html); }, }); }And the following HTML:
<div id="video">
</div>
<br/>
<button onclick="video()">Carregar</button>
But when I click on the "press" button nothing happens.
Check if you are entering the video function by clicking the button? If so, check if you are entering the ajax Success function. To access the page you are giving 2 clicks on . html and running the function or accessing via http? I think this ajax request, as it is, only works via http. Implement the ajax error method to see the error message.
– Onaiggac
You must be having some error, if you are using Chrome, press F12 and post here the error that is giving. probably must be Xmlhttprequest error
– Paulo Roberto
And what content is inside the video.html file?
– Giancarlo Abel Giulian
what happens if in the ready vc put Alert(html)? Is the video.html page in the same folder as the executed page? You can also test using <button onclick="video();window.open('video.html')"> to see if it is loading correctly. If she is, try replacing the div tag with an embed
– jefissu
Did you import the jQuery library? You don’t have to do it this way there are better ways to load a video dynamically.
– Ivan Ferrer