There is a great post by Mister Dai showing several scenarios. Credit to him for discovering the underlying solution!
Friday, April 5, 2013
UDF for converting a query string to a structure
Have you ever needed to work with url query string parameters? Working with a list is no fun, hence why I wrote the convertQueryStringToStruct UDF. This makes building search criteria displays much easier.
Standard responses with Response.cfc
Standardizing responses is useful so you know what to expect when you make a service call. That is why I wrote Response.cfc (github repo link).
This response object by default returns a json packet so it can be easily manipulated by AJAX and remote API requests. For non-AJAX/non-remote calls, I like to deserialize the json immediately after getting the response.
Properties of Response.cfc are below with sample use cases.
Credit to Ben Nadel's Building An AJAX, jQuery, And ColdFusion Powered Application post for inspiring this.
This response object by default returns a json packet so it can be easily manipulated by AJAX and remote API requests. For non-AJAX/non-remote calls, I like to deserialize the json immediately after getting the response.
Properties of Response.cfc are below with sample use cases.
- data (used to pass back context data)
- errorCode (used to pass a unique code)
- errorDetail (used for debugging)
- errorMessage (used for generic messaging back to the user)
- errors (each error to report back to the user)
- statusCode (http status code for use by remote calls)
- statusText (http status text for use by remote calls)
- success (boolean flag for overall status of request)
Credit to Ben Nadel's Building An AJAX, jQuery, And ColdFusion Powered Application post for inspiring this.
Subscribe to:
Posts (Atom)