Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Een AJAX Request zonder jQuery:
- function loadXMLDoc()
- {
- var xmlhttp;
- if (window.XMLHttpRequest)
- {
- xmlhttp = new XMLHttpRequest();
- }
- else
- {
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange = function()
- {
- if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
- {
- document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.open("GET", "ajax_info.txt", true);
- xmlhttp.send();
- }
- // Dezelfde functie maar dan afgekort met jQuery:
- $.ajax(
- {
- url: "ajax_info.txt",
- succes: function(data) {
- $("myDiv").html(data);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment