jquery - Testing WebApi availability from Javascript or C# -
my asp.net mvc 4 website connects external webapi service. have page set baseaddress uri , consequently want know webapi service status everytime baseaddress changed.
i don't want page blocked while status if being checked.
i tried on controller side, need have api call async task, don't know how deplayed response.
so thought doing jquery ajax method.
my question : correct place ? , if on controller, how result ?
thanks
it makes sense on client side using jquery ajax method. think best practice client-side validation when can avoid round trips server. if understand trying do, validate user has entered valid base uri points them web api. validation can done on client jquery ajax long web api call make not update state information on server. have javascript functions associated success , error events on ajax method. if hits success function validation successful; if hits error function validation fails.
Comments
Post a Comment