I’m at witts end. I originally got this working using a regex php file and returning the data via ajax with no problems. But each time there was a link on the page it requests that php file, and with many links it returned many iterations of the page and many requests it just isn’t fantastic.
An example of the data I’m looking at parsing is here:
You can see when visiting this page, it looks to me like a javascript function.
I am able to successfully get this data response by looking at ‘Network’ in Google Chrome Developer Tools, but I’m unsure how to parse it from there to my js file so I can insert it into my html.
Currently you’re logging the iconaddy variable which will always return null, instead what you want to be doing is logging the data parameter been set in your anonymous function for success. To set the variable you can simply assign the value of data to the iconaddy variable, you will have to make one small change when doing that though which is to add the async setting in your ajax request and set the value to false which will make the request synchronous which means the code following the ajax request will only get triggered upon the request been completed first.
Thanks for your response chris. I have adjusted my code to match was you suggested, but it appears I’m still having issues. Here’s my code and I have attached a screenshot of the response. The blue line represents a particular line from the response I’m after.