2013-02-21 71 views
0

當使用下面的代碼時,我需要調用Transmit_SOAP()函數。但它沒有打電話。有什麼問題嗎?無法調用函數

function sample() 
{ 
var xmlSoapTemplate; 
xmlSoapTemplate = new XMLHttpRequest(); 
xmlSoapTemplate.onreadystatechange = function() { 
if (xmlSoapTemplate.readyState == 4) Transmit_SOAP() 
}; 
} 

function Transmit_SOAP() 
{ 
alert("Function calls");  
} 

回答

0

你缺少open()send()電話,你不告訴它使用什麼URL等

這裏有一個粗略的例子:爲努力

request = new XMLHttpRequest(); 

request.open('GET','http://www.example.com/', true); 
request.onreadystatechange = function() { 
    if (request.readyState == 4) { 
     ... 
    } 
} 
request.send(); 
+0

感謝。最後它工作。 – Mohan 2013-02-21 10:12:44