Click here to Skip to main content
14,830,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I was wondering if someone can help me with that:

I have a ajax request that calls a function
in that function I create a web request to a hotel API
the response contains 30 results

I would like to return the results to the View and start immediatley another ajax request that calls a function with a web worker which gets the rest of the eg 500 results and save them in a database

this function should be just called but not been waited to be finished

I hope I explained it not too confused:)

thanks a lot in advance

karthik Udhayakumar 22-May-14 12:25pm
Let us know what you have troed and where your stuck up?

1 solution

Hey! Thanks for your reply! I have solved the problem :)
I created a function with return JSON but before it returns it it calls a subroutine:

Function testFunction() As JsonResult
   System.Threading.ThreadPool.QueueUserWorkItem(AddressOf DoAsyncWork)
   Return Json("success", JsonRequestBehavior.AllowGet)
End Function
Protected Sub DoAsyncWork()
   Do some work
End Sub

Anyway, thanks for your help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900