I want to make two ajax calls in a click event. Each ajax call does a distinct operation and returns back data that is needed for a final callback. The first call is an onload event the returns a search form with id's generated from the api. This api is returning the search form with no issues. The calls themselves are dependent on one another, and the final one can only work with the results from the first one. The error that I get is f is not defined.
$(document).ready(function() {
var searchForm = (function() {
$.ajax({
async: true;
//"code"//
data.map(function(f)) {
return <input id=f.Datafield>
}
});
});
$("#btn").on("click", function(event) {
event.preventDefault();
var id = searchForm($("#" + f.DataField));
$.ajax({
URL= "api" + id
async:true;
});
});
searchForm()
}