My code below is :
I'm performing a client side request to hit the server and get a token and get the response object of token and repost the dynamic token to server to get the image on the browserCode:function getTicket() { try { alert("Get Ticket") var tableauInfo = { username: "xxxxxxxx", site_root:"POC1", client_ip:"xx.xxx.xxx.xx" } //$('#getTicket').html('sending..'); var dashboardResourceURL = "https://analytics.xxxxxxx/trusted/##TOKEN##/t/POC1/views/ExampleVis/Dashboard1?:iid=1" var resourceURL = "https://analytics.xxxxxxxxxxx/trusted" $.ajax({ method: 'POST', url: resourceURL, data: JSON.stringify(tableauInfo), dataType: 'html', contentType:'application/x-www-form-urlencoded; charset=UTF-8', crossDomain: true, }) .success(function (result) { alert(Json.stringify(data)); dashboardResourceURL.replace("##TOKEN##",result); alert(dashboardResourceURL); $('#tokenurl').show(); $('#tokenurl').src= dashboardResourceURL; $('#getTicket').html(data.msg); }) .fail(function(data){ console.log('failed!! ', data); $('#getTicket').html("Error retrieving ticket from Tableau server"); }); } catch(err){ console.log('an unforseen error occurred; it is ', err); } }
I'm getting an error:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
Please suggest how to get rid of this error.
Thanks in advance.




Reply With Quote
