Frage

I have the URL: http://website.com/xml_searchresults.php?cityID=1&type=1&searchTerm=Mark\'s Sports Bar&showOpenOnly=0

I generate it in PHP and then send it to Javascript:

var searchURL = "<?php echo $searchURL; ?>";

I'm using Javascript for Google Maps but my maps can't read the XML file when there's an apostrophe in the URL string. I don't want to remove it because the XML file looks for a perfect match in my database when doing a search ranking. I've been able to work around it in the PHP no problem, but my maps are killing me.

I don't know a whole lot about the intracracies of Javascript but I'm convinced the blank maps come from errors when an apostrophe is present.

War es hilfreich?

Lösung

@Chen Asraf

Both the apostrophe and the slash were causing problems so like you said I removed them and added them back later as seen here: PHP function for removing and adding back in \'?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top