AnsweredAssumed Answered

The Aspect Asynchrone of the methode Ajax.request

Question asked by ghribi.wajdi.ensi on Jan 26, 2014
Hi , i m trying to call a webscript using Ajax request, to do that i implemented this code:

alert("1");
mymethod:function mymethod(){
alert("2");
}
Alfresco.util.Ajax.request({
url: webscriptUrl,
method: POST, 
requestContentType: "application/json",
onsuccess:
fn:mymethod();
)}
alert("3");
 

if the calling of the webscript was executed with success the result would be :

1
2
3

but i always get this result:

1
3
2

i thing that's because of the aspect asynchrone of the methode Ajax, is there any idea or a workaround to make that work ?
Notes:
<ul> <li> Please ignore any syntax error in my code</li>
<li>the idea of puting alert("3" ) in my methode is rejected of course LOL,  </li> <ul>
thanx

Outcomes