Aronaman
1 month ago

ajax callback

Posted 1 month ago by Aronaman
<div class="col-xs-12 col-sm-12 col-md-12 text-center ">
      <button  id="finish" class="btn btn-primary">finish</button>
 </div>

//script

 $('#addNew').click(function(cb){

    $.ajax({
 type:GET;
 url:'Get/local/'
 dataType:'json',
 data:form_data,
success:function(res){ 

cb(res); 
}
});

//and now I want to pass res I get to other function, and I try this, but not working

$('#finish').click(function(res){
console.log(res);

});

any help, please. res..give me data of an object. my problem is I am new to ajax and I don't know how to a callback res to other function

Please sign in or create an account to participate in this conversation.