Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey!

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

Cheers
Posted
Comments
karthik Udhayakumar 22-May-14 12:25pm    
Dear,
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:

VB
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
Cheers!
 
Share this answer
 
v2

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