# ajaxCallAction error handling?

**URL:** <https://community.thinkgeo.com/t/ajaxcallaction-error-handling/4324>\
**Category:** MVC\
**Created:** [August 20, 2015, 3:52pm UTC](https://community.thinkgeo.com/t/ajaxcallaction-error-handling/4324 "2015-08-20T15:52:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/ed8c4c/32.png) [@Jay](https://community.thinkgeo.com/u/Jay)\
**Post date:** [August 20, 2015, 3:52pm UTC](https://community.thinkgeo.com/t/ajaxcallaction-error-handling/4324/1 "2015-08-20T15:52:40Z")

</div>

Is&nbsp;there&nbsp;any&nbsp;error&nbsp;handling&nbsp;possible&nbsp;for&nbsp;ajaxCallAction,&nbsp;for&nbsp;the&nbsp;case&nbsp;when&nbsp;the&nbsp;method&nbsp;on&nbsp;the&nbsp;backend&nbsp;throws&nbsp;an&nbsp;exception&nbsp;or&nbsp;otherwise&nbsp;encounters&nbsp;an&nbsp;error?

---

<div class="post-metadata">

**Author:** ![Troy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@Troy](https://community.thinkgeo.com/u/Troy)\
**Post date:** [August 21, 2015, 1:05am UTC](https://community.thinkgeo.com/t/ajaxcallaction-error-handling/4324/2 "2015-08-21T01:05:51Z")

</div>

Hi&nbsp;Jay,  
  
  
  
In&nbsp;Mvc&nbsp;Edition,&nbsp;If&nbsp;you&nbsp;debug&nbsp;into&nbsp;the&nbsp;method&nbsp;from&nbsp;the&nbsp;func\_GeoResource.axd,&nbsp;you&nbsp;will&nbsp;find&nbsp;we&nbsp;are&nbsp;using&nbsp;Sys.Net.WebRequest&nbsp;instance&nbsp;to&nbsp;send&nbsp;ajax&nbsp;call.&nbsp;Here&nbsp;is&nbsp;a&nbsp;link&nbsp;about&nbsp;this&nbsp;instance:&nbsp;[msdn.microsoft.com/en-us/li…100).aspx](https://msdn.microsoft.com/en-us/library/vstudio/bb310979(v=vs.100).aspx)

> `ajaxCall: function (url, params, callback) {`  
> `        ``var wRequest = new Sys.Net.WebRequest();`  
> `        ``wRequest.set_url(url);`  
> `        ``wRequest.set_httpVerb(‘POST’);`  
> `        ``var mapParser = this.getMapParser();`  
> `        ``var param = ‘ __#’ + mapParser.pageName + "|__ #";`  
> `        ``for (var item in params) {`  
> `            ``param = param + item + ":" + params[item] + ‘^’;`  
> `        ``}`  
> `        ``wRequest.set_body(param);`  
> `        ``wRequest.add_completed(callback);`  
> `        ``wRequest.invoke();`  
> `    ``}`

  
In&nbsp;the&nbsp;call&nbsp;back&nbsp;parameter,&nbsp;you&nbsp;can&nbsp;use&nbsp;this&nbsp;parameter&nbsp;to&nbsp;access&nbsp;the&nbsp;executor&nbsp;that&nbsp;issued&nbsp;the&nbsp;request&nbsp;and&nbsp;to&nbsp;check&nbsp;its&nbsp;completed&nbsp;status&nbsp;and&nbsp;retrieve&nbsp;the&nbsp;response&nbsp;data.&nbsp;So,&nbsp;you&nbsp;can&nbsp;check&nbsp;the&nbsp;response&nbsp;status&nbsp;and&nbsp;handler&nbsp;the&nbsp;error&nbsp;from&nbsp;the&nbsp;server&nbsp;side.  
  
  
  
If&nbsp;any&nbsp;questions,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.  
  
Thanks,  
  
Troy
