How can i get the data from a AJAX request saved in a variable with jQuery?
How About This?
For Json Data:
var BaseConfig=$.ajax({
async:false,
url:'./config.php',
type:'get',
data:{'GetConfig':'YES'},
dataType:"JSON"
}).responseJSON;
And For Text Data:
var BaseConfig=$.ajax({
async:false,
url:'./config.php',
type:'get',
data:{'GetConfig':'YES'},
dataType:"TEXT"
}).responseText;
var myvar;
$.ajax({
url: 'mything.php',
success: function(data) {
myvar = data;
}
});
use this
var myvar='';
$.ajax({
type:'post',
url: 'your url',
dataType:'text',
success: function(data) {
useReturnData(data);
}
});
function useReturnData(data){
myvar = data;
console.log(myvar);
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With