Ajax success value to parent function
Just added below lint and it worked. Is it good using the below line to fix the issue? any suggestions please
async: false,
function GetString(key) {
var keyValue = «»;
$.ajax({
async: false,
type: «POST»,
url: «ajax.aspx/GetCMString»,
data: ‘{key: «‘ + key + ‘» }’,
contentType: «application/json; charset=utf-8»,
dataType: «json»,
success: function (response) {
keyValue = response.d;
},
failure: function (response) {
alert(response.d);
}
});
return keyValue;
}
<script type = «text/javascript»>
function Getdata(key)
{
var data = GetString(key);
alert(data);
}
</script>
Continua leyendo «Ajax function return value, retormnando valor usando Ajax»