Solved

Getting dynamic value from 3rd party page and passing to a function on another page

Posted on 2016-10-30
1
69 Views
Last Modified: 2016-10-30
I'm trying to figure out how to grab the PDV_n9559649 value when a sample 3rd party URL is hit:

https://polldaddy.com/n/413dd20f300b3fe5532c4c3b08bf9684/9559649?1477900000003

and renders the following:

PDV_n9559649='c3312b14d3|945';PD_vote9559649(0);

But trying to read into a JS function on my page somehow? Is that even possible with some type of callback function? If not what other alternatives do I have?
0
Comment
Question by:894359
1 Comment
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
ID: 41866198
No it's not possible to do this on the client (possible security risk and so it is outlawed).  You will need to do this on the server.  As that URL does not return JSON it's not possible to use jsonp (a cross site scripting workaround)

XMLHttpRequest cannot load https://polldaddy.com/n/413dd20f300b3fe5532c4c3b08bf9684/9559649?1477900000003. No 'Access-Control-Allow-Origin' header is present on the requested resource.

Therefore you should use a server side language (such as PHP) to request that URL via cURL or file_get_contents and return that to your page.

You can return that to your page using AJAX
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now