Changeset 27811

Show
Ignore:
Timestamp:
11.07.2013 15:40:50 (6 years ago)
Author:
sjm84
Message:

callMetadataServer now uses jquery

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js

    r27713 r27811  
    424424function callMetadataServer(callingFunction, url, responseFunction) 
    425425{ 
    426     var ajax = new gs.functions.ajaxRequest(); 
    427     ajax.open("GET", url, true); 
    428     ajax.onreadystatechange = function() 
    429     { 
    430         if(ajax.readyState == 4 && ajax.status == 200) 
    431         { 
    432             console.log("(" + callingFunction + ") Response received from server: " + ajax.responseText); 
    433              
    434             if(responseFunction != null) 
    435             { 
    436                 responseFunction(ajax.responseText); 
    437             } 
    438         } 
    439         else if(ajax.readyState == 4) 
    440         { 
    441             console.log("(" + callingFunction + ") Failed"); 
    442         } 
    443     } 
    444     ajax.send(); 
     426    $.ajax(url) 
     427    .success(function(response) 
     428    { 
     429        console.log("(" + callingFunction + ") Response received from server: " + response); 
     430 
     431        //var xml = $.parseXML(response); 
     432        //console.log(xml); 
     433         
     434        if(responseFunction != null) 
     435        { 
     436            responseFunction(response); 
     437        } 
     438    }) 
     439    .error(function() 
     440    { 
     441        console.log("(" + callingFunction + ") Failed"); 
     442    }); 
    445443} 
    446444