Skip to content
Loading
  
  •   
  • Now in the code i have taken the url as default and the output you will get something like
    But please try to get the code , url is not the direct url you will get it after you do an ajax call. And it looks like the response is something like { "url": "https://moviestarstorage.blob.core.windows.net/water/gol.mp4" } . So your code should look like following :
    1. $("#btnVideo").click(function () {  
    2. var linkurl = "http://104.211.243.204/?container=comedy-movies&blob=" + encodeURIComponent($("#itemList").val());  
    3. $.ajax({  
    4. url: linkurl, success: function (result) {  
    5. jsonResponse = result;  
    6. playVideo(jsonResponse.url);  
    7. }  
    8. });  
    9. });  
    Try and let me know if above code works.
     
    Regards,
    Mukesh Nayak
    +2
  • +1
    @Mukesh Nayak sir I have tried this , when i provide url manually it works fine. But when i try to give url after ajax call it shows me the following error:-
     
    Failed to load http://104.211.243.204/?container=comedy-movies&blob=come1.mp4: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:50136' is therefore not allowed access.
     
    Please help me regarding this. I have search for this error but nothing was work for this error. 
    +1
  • Mukesh Nayak
    +1
    Hi Abhijeet,
     
    You need to enable cors on your API side.Please refer the link below :
    https://www.c-sharpcorner.com/forums/web-api-error-quotno-sharp39accesscontrolalloworiginquot 
    Please let me know if that works.
    Regards 
    Mukesh Nayak 
    +1