How to pass parameter back from asp.net web service if an insert to a database was successful? ASP.NET/jQuery/AJAX/JSON?

You want to return a result object with an isSuccess and id property. You can then do the following.

You want to return a result object with an isSuccess and id property. You can then do the following: success: function (result) { if (!result. IsSuccess) { // display friendly error message indicating that the db insert failed } else { var id = result.Id; // do client side processing with primary key returned from db insert } } How you return the result object depends on your web services framework (e.g. , WCF, MVC, WebMethod, etc. ).

The framework will serialize your . NET object to a JSON encoded result (e.g. , { isSuccess: true, id: '1234'}). As an example, in ASP.

NET MVC you simply return a JsonResult using Json.(MySerializableResult). If you post what you are using for web services, I'm sure you'll get a specific answer to that framework.

Thanks for the input, will try it out. I use the kind of web service that is in the link I posted (WebMethod). – Morgan Oct 29 '10 at 6:24.

You want to return a result object with an isSuccess and id property. You can then do the following: success: function (result) { if (!result. IsSuccess) { // display friendly error message indicating that the db insert failed } else { var id = result.Id; // do client side processing with primary key returned from db insert } } How you return the result object depends on your web services framework (e.g. , WCF, MVC, WebMethod, etc. ).

The framework will serialize your . NET object to a JSON encoded result (e. G { isSuccess: true, id: '1234'} ) As an example, in ASP.NET MVC you simply return a JsonResult using Json.(MySerializableResult) If you post what you are using for web services, I'm sure you'll get a specific answer to that framework.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions