I have implemented an ajax-polling script that calls an action in the server Controller every 10 seconds. With the response, I replace the content of a div:
div
Did you try using absolute url?
var link = 'https://www.yourdomain.com/Secure/GetFoo';