0
I have the following javascript line:
...
var refundVal = $( ".refundVal" ).val();
var dt={
orderId:orderId,
refundVal:refundVal,
process:btnProcess
};
window.srObjc.confirm("message $"+refundVal+" ?").promise.done(function(dt)
{
console.log("test0"); //L1
console.log(dt); //L1
console.log("test1"); //L1
console.log(refundVal);//L4
//Ajax
var request =$.ajax({
url: "pagamentos.php",
type: "POST",
data: dt,
dataType: "json"
});
request.done(function(dataset){
var resut = dataset;
var str = JSON.stringify(resut, null, 2);
alert(str);//test
container.html(render(resut));
$('#raw-data').html(syntaxHighlight(str));
console.log(str);//test
});
}//window.srObjc.confirm
In this example the value refundVal is equal to $1.
this is the result in console.log:
The value of "dt" is showing "ok". I expected to see an object with the values in the doconsole log.
And the value of refund val is correct =$1, and I wasn’t expecting this because I’m not sending this value in the function parameter promise.done(function(dt)
.
So the question is how do I send this object into the function and see the correct display in the console.log ?
dt
is global in this code you showed. So if you do not declare (via function parameter) adt
new, it will be accessible. Stripdt
from here:promise.done(function(dt)
– Sergio