Quick Question, If Statement on Blank Data from XML

Ok, it worked once but stopped working when I added more information into the XML database. Anyway, I have a section of my xml that has a URL it pulls in, but for some, there’s not website to link to so I wanted to leave it blank. In XML, it looks like this:

<url></url>

I have my statement set up in the following code. The else statement works fine, but the if statement calling for nothing doesn’t. Here’s the code:


if (url[p]=="") {
                url_txt.htmlText = "<p alight=\"right\">No URL, See Description</p>";
            }else{
            url_txt.htmlText = "<p align=\"right\"><a href=\""+url[p]+"\" target=\"_blank\">"+url[p]+"</a></p>";
            }

On the selections with no URL in my XML, it says Undefined, and the ones that have a URL, work as specified.

I’ve also tried making the if statment (url[p]==" ") but that doesn’t work either.

I know its something easy, but I need a pair of fresh eyes to look at it as I’ve been coding this site for 2 weeks.

Thanks in advance.

I figured it out myself.

for future reference, instead of “”, you can simply use undefined.

This found that that XML response was undefined and spits out my string instead (which by the way, I realized I mis-spelled align and fixed that too :P)