Skip to main content
Commonmark migration
Source Link

Let's look at this: if(jQuery.isEmptyObject(content))

What is inside the variable content when you pass it to the showInfo() function via the addMarker() function?

It's always a long string full of html code, right? Even if the response from $.getJSON inside addMarker() was an empty.

So this if(jQuery.isEmptyObject(content)) part won't ever work as you intend, because content is not a JavaScript empty object, but just a long string always full of html.

Look at jQuery.isEmptyObject() documentation: [![enter image description here][1]][1]enter image description here

Now try to call $.isPlainObject on content to see what's the output. I'm sure it won't return true.

Maybe you should check if $.getJSON returned any links inside the addMarker() function, and if there are no links you set content to be what you want to be before you pass it to showInfo(). [1]: https://i.sstatic.net/cssId.jpg

Let's look at this: if(jQuery.isEmptyObject(content))

What is inside the variable content when you pass it to the showInfo() function via the addMarker() function?

It's always a long string full of html code, right? Even if the response from $.getJSON inside addMarker() was an empty.

So this if(jQuery.isEmptyObject(content)) part won't ever work as you intend, because content is not a JavaScript empty object, but just a long string always full of html.

Look at jQuery.isEmptyObject() documentation: [![enter image description here][1]][1]

Now try to call $.isPlainObject on content to see what's the output. I'm sure it won't return true.

Maybe you should check if $.getJSON returned any links inside the addMarker() function, and if there are no links you set content to be what you want to be before you pass it to showInfo(). [1]: https://i.sstatic.net/cssId.jpg

Let's look at this: if(jQuery.isEmptyObject(content))

What is inside the variable content when you pass it to the showInfo() function via the addMarker() function?

It's always a long string full of html code, right? Even if the response from $.getJSON inside addMarker() was an empty.

So this if(jQuery.isEmptyObject(content)) part won't ever work as you intend, because content is not a JavaScript empty object, but just a long string always full of html.

Look at jQuery.isEmptyObject() documentation: enter image description here

Now try to call $.isPlainObject on content to see what's the output. I'm sure it won't return true.

Maybe you should check if $.getJSON returned any links inside the addMarker() function, and if there are no links you set content to be what you want to be before you pass it to showInfo().

Source Link
Yuri Laguardia
  • 2.6k
  • 1
  • 10
  • 17

Let's look at this: if(jQuery.isEmptyObject(content))

What is inside the variable content when you pass it to the showInfo() function via the addMarker() function?

It's always a long string full of html code, right? Even if the response from $.getJSON inside addMarker() was an empty.

So this if(jQuery.isEmptyObject(content)) part won't ever work as you intend, because content is not a JavaScript empty object, but just a long string always full of html.

Look at jQuery.isEmptyObject() documentation: [![enter image description here][1]][1]

Now try to call $.isPlainObject on content to see what's the output. I'm sure it won't return true.

Maybe you should check if $.getJSON returned any links inside the addMarker() function, and if there are no links you set content to be what you want to be before you pass it to showInfo(). [1]: https://i.sstatic.net/cssId.jpg