Showing posts with label Ajax. Show all posts
Showing posts with label Ajax. Show all posts

Tuesday, August 2, 2011

javascript undefined

var a;
var b = null;
var c = "";
// d is not declare



//  var a;
typeof(a)                           return undefined
a == undefined                 return true
a === undefined               return true

// var b = null;
typeof(b)                           return object
b == undefined                 return true
b === undefined               return false

// var c = "";
typeof(c)                           return string
c == undefined                 return false
c === undefined               return false

// d is no declare
typeof(d)                           return undefined
d == undefined                 throw exception
d === undefined               throw exception

Saturday, July 30, 2011

jQuery Examples

// ajax callback functions
success(data, textStatus, jqXHR)
A function to be called if the request succeeds.

error(jqXHR, textStatus, errorThrown)
A function to be called if the request fails.

complete(jqXHR, textStatus)
A function to be called when the request finishes
(after success and error callbacks are executed).

Thursday, November 4, 2010

Manipulate XML string from iFrame

// get iframe
var iframe = document.getElementById("myIframeId");
var xDoc = null;
// get XmlDocument
// for IE
xDoc = iframe.contentWindow.document.XMLDocument;
// for firefox, chrome, safari,
xDoc = iframe.contentDocument.documentElement;

// Manipulation XmlDocument or XML element node
xDoc.getElementById("elmId");
xDoc.getElementsByTagName("div")[0];
xDoc.getAttribute("name");
xDoc.innerHtml;
xDoc.getElementById("inputTxtId").value;

// for IE
xDoc.innerText;


// for firefox, chrome...
xDoc.textContent;

Sunday, July 11, 2010

Microsoft Ajax

<script type="text/javascript" src="/script/MicrosoftAjax.js"></script>





<script type="text/javascript">

    function onclickBtn1()
    {
        var wRequest = new Sys.Net.WebRequest();
        wRequest.set_url("/test.aspx?id=3");
        wRequest.add_completed(
            function(executor, eventArgs)
            {
                alert(executor.get_responseData());
             });
        wRequest.invoke();
    }
</script>