0

I am attempting to retrieve the array containing news articles for my marker infoWindow in the addMarker function using the following code snippet:

 var parameter{
    geo: place.postal_code
 }

 $.getJSON("articles.php", parameter)
 .done(function(data, textStatus, jqXHR) {

            var articles = data;
 }

However, as soon as I add this code, my program hangs and no longer displays any of my markers (which worked previous to this). I think I need to get this data in an array, so that I can somehow explode it into content I can use in infoWindow, but I can't get past this.

articles.php is returning the correct array of links and titles when accessing it directly thru the browser.

Is there an error in this code and/or should I be using a different (simpler) method to get and display this info. Any hints/help/links to reference materials would be very much appreciated. I've spent hours and hours on this issue.

0
3

Replaced with:

 $.getJSON("articles.php?geo="+place.postal_code)
.done(function(data, textStatus, jqXHR) {
        more code
}     

and now call is returning data. Still not sure why previous code didn't run, but now project works!

4
  • where you have //more code what did you put there? articles = data.title ? – Kohl Mar 1 '15 at 16:35
  • I called a function I wrote which loops thru the news list, puts them into HTML and puts the result into the marker's infoWindow. – pokerbeing Mar 2 '15 at 22:18
  • thanks @pokerbeing, I figured it out – Kohl Mar 3 '15 at 2:44
  • Good! This one was a bit of a bear. – pokerbeing Mar 5 '15 at 13:27
-1
$.getJSON("articles.php", parameters)
 .done(function(data, textStatus, jqXHR)

The reason the original code did not work is that "parameters" has to be plural.

I tested this by removing the "s" in my code and the news articles no longer populated. When I put the s back it worked again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .