Help me please, how to get result from jquery function ?
$(document).ready(function(){
$.ajax({
url: "http://somemywebsite.com/getdata.php",
type: 'GET',
dataType: 'json',
success: function(res) {
$( "input[name*='fname']" ).val( res ); /// this code works, fname field was changed to my!
}
});
//but how i can get the result of code?
alert(res); /// Doesn't work, empy!
var test = $( "input[name*='fname']" ).val;
alert(test); //Doesn't work too
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
All data got empty status ...