Skip to content
Loading
c#, JSON ,API response in JSON, Store response into variable
Regards,
Mukesh Nayak 
  • Mukesh Nayak
    Hi ,
    I think in the code where you have mentioned 
    1. $("#btn").bind("click"function () {  
    2. var url = "http://104.211.243.204/?container=comedy-movies&blob=" + encodeURIComponent($("#itemList").val());  
    3. window.location.href = url;  
    4. });  
     change it to ajax call  such as 
    1. $("#btn").bind("click"function () {  
    2.             var apiurl = "http://104.211.243.204/?container=comedy-movies&blob=" + encodeURIComponent($("#itemList").val());  
    3.             var jsonResponse;  
    4.             $.ajax({  
    5.                 url: apiurl, success: function (result) {  
    6.                     jsonResponse = result;                     
    7.                 }  
    8.             });     
    9.         });   
     Regards,
    Mukesh 
  •  
     
     
    -----------------This is my code. sir i have tried this. So it redirects window to url where api returns json response. 
  • Mukesh Nayak sir... I want to store that response in client side variable. whatever you understand is correct . now I want to store that response in client side variable.
     
    Now i uploaded my code . Please refer it and guide me according to my code.
     
    Thank you 
  • Mukesh Nayak
    Hi Abhijeet,
     
    if i understand your question correctly you want to say that you have got a button in UI and on click event of that you are doing ajax call which in turn calling web api which is sending data in json. Now you are in client side code where you are doing ajax call you are getting data back.
    Now i want to konw whether you want to store that json data in client side variable or server side variable?
    Please feel free to rectify my understanding.
    Regards,
    Mukesh Nayak