Latest comments and ratings
On GPT-4
علی اکبر خانبابائی
Dec 31, 2023
چطور در متود زیر بعد از جواب دادن ajax مقداری را برگردانم از متود یعنی اینکه متود صبر کند تا مقداری از ajax برگردد سپس به راه خود ادامه دهد
تمام این ها در jquery است
function ajaxBehpardakht(rawPrice/*, tarefelist, etebar, data, totalTarefe*/) {
var myJSON1 = '{"ServiceCode" :"1","Amount":"' rawPrice '","PayerId":"","PcID":""}';
var multiaccount = localStorage.getItem('multiaccount');
/* if (multiaccount == "true") {
var BofeId = localStorage.getItem('BofeId');
var KhedmatId = localStorage.getItem('KhedmatId');
var myJSON1 = {
"ServiceCode": "1", "TotalAmount": rawPrice "", "RequestList": [
{ "AccountID": BofeId "", "Amount": etebar "", "PayerID": "0" },
{ "AccountID": KhedmatId "", "Amount": totalTarefe "", "PayerID": "0" },
], "PrintDetail": "1", "PcID": "1234"
}
}
*/
var myObj1 = JSON.parse(myJSON1);
$.ajax({
type: "POST",
contentType: "application/json",
//<!-- Access-Control-Allow:*, -->
url: "http://localhost:1024/bpmpospc/service",
data: myJSON1,
crossDomain: true,
success: function (obj) {
console.log(':: ' obj);
var x = (obj.ReturnCode);
console.log(":: Result.RespCode :" x);
pardakht2();
//var x ="00";
/* if (x == 100) {
pardakht2();
}
else {
ErrorModal();
}*/
}
, error: function (xhr, ajaxOptions, thrownError) {
ErrorModal();
}
}); //ajax
}