Posts Tagged AJAX

Updating Whats-hot-weekly

My task for this morning is to add additional site codes to It’s not an easy task. At least, it isn’t as easy as I thought it would be. All of the categories are pulled from a database that I refresh every so often. The database only contains the categories for the US eBay site. This is where it gets hairy because I wasn’t aware before now that the other countries used didn’t categories. So, now my task is to add all the categories so I can implement the additional sites.

This is going to take a while. The US along takes around half an hour. There are many other sites. I’ve recreated the database adding a field to record the site_id. Next I’ll run my scripts to populate the database with API calls. After I populate the database for the US, I’ll switch the site codes manually and add the next site. I would automate this but I would rather monitor it anyway so I thought I may as well do it manually.

The big issue that will come up later is currencies. I’ll have to adjust for that. I’ll also have to recreate the same code on the static version of the site.

While I wait for the database to refresh, the old site is still running as normal. I have a development environment that is a working copy of the production environment. I’ll make the switch there, then simply move it over to production from there. There should be exactly no downtime to the site. I hope.

, ,

No Comments

responseXML.documentElement is null or not an object

Ok I have yet another reason to loath IE7. I had an error on earlier in regard to this error message on my ajax XML object:
responsexml.documentElement is null or not an object
Everything worked in Firefox, Chrome, and even my Nokia N810’s browser, but IE7 just wasn’t going to cooperate. I knew that it was working last night, but I made a few changes before going to bed.

Two of the changes I made was in relation to the meta tags in the HTML of the main index page. I added keywords and description for search engine optimization. Little did I know that one of these was the culprit.

After much Googling, I came upon this article. In it I immediately found the reason for the error. It should have been a little obvious but I had overlooked something simple. My search box for entering in keywords had an id(and name) of “keywords”. The new meta tag for keywords also used the “name=keywords” attribute.

In the article, it was the “description” meta tag that had caused the conflict. Upon evaluating that, I realized my mistake. This effected IE only because IE checks the name attribute when you call document.getElementById. It was grabbing the meta element instead of the search box.

I hope this helps someone else, in the event that all the variables fall into place for this to happen again.

No Comments

AJAX Cross Domain Work-around

Any of you that are AJAX developers can skip this post. I’ve just recently started concentrating on AJAX for a project I’m working on. In the past, I’ve used PHP to parse XML returned from various web services and it goes off without a hitch. I also wrote my own web service in PHP for this project.

The project is basically a site that works with the eBay API to pull the most watched items for any keyword search phrase and by category. I’ve pulled all the categories to a local database. This will allow me to avoid using an API call every time someone clicks through different categories. All the categories are in an AJAX menu system I wrote. The menu is completely dynamic and loads the categories and subcategories using calls to my web service. This part was fun because it gave me the opportunity to create a web service and this in itself was worth the time I’ve spent on the whole project.

I ran into a road block however, because I wasn’t aware that AJAX doesn’t allow cross-domain calls. At least from what I see, it doesn’t. I started getting an error 1012 “Access to restricted URI denied’.” This means that the actually calls I would like to make to the eBay API won’t work through AJAX. I wrote the code to try to do so and kept getting this error. That’s when I found out that it wasn’t possible to do this using AJAX. It’s fine in PHP, however. So, here is the work-around I’m brain-storming. I know it’ll work. It’s just a matter of doing it.

The work-around is simply to write another web service in php that makes the calls for me. Then use AJAX to pull the info dynamically from the localhost. The up side to this is I can also log various stats about the calls within the web service as well. I could create a table in my database to log the searches, time of day, IP address of user, and so on. This will allow me to understand how the app is being used, who’s using it, when they are using it, and what they are using it for.

This is also known as using AJAX through a proxy. Where the proxy is the web service on the localhost from which one can make an AJAX call to.
So, I’m off to code another web service.

, ,

No Comments