Jump to content
Larry Ullman's Book Forums

Chapter 14 - Recording Favorites Using Ajax


Recommended Posts

The first step is to run the PHP scripts (that Ajax calls) directly in the browser to make sure they don't have a parse error or whatever. Second, use the network tools in the browser to see the requests being made and the response. 

Link to comment
Share on other sites

OK, Larry.  I've never used the network tools in the browser.  What are they? How do I use them on Chrome?  I'm assuming Internet Explorer is probably not as good for this?

 

There was an error in the ajax/favorites.php script.  My hosting provider does not allow REPLACE queries.  So I had to change the code to an INSERT query.

Link to comment
Share on other sites

The issue with the INSERT query is it will fail if you're trying to insert using the same primary key. If you can't use REPLACE, then you should use INSERT for new records but UPDATE for existing ones. 

 

As for the network tools, I just Googled and this is a resource for Chrome (which is what I primarily use): https://developer.chrome.com/devtools

 

And you can Google for IE resources: https://www.google.com/search?q=internet%20explorer%20developer%20tools

 

But it'll probably be better if you add in the specific IE version. 

Link to comment
Share on other sites

In my case it's for a real estate website, so I added a column "active".  This will allow me to track which properties users are adding as a favorite and then removing that same property.  It also allows me to reach out to buyers and see what they like and dislike.  In the users dashboard this will be helpful for the user to re-activate any favorites he may have removed by mistake.

 

Thanks for your quick responses, Larry.  Always appreciated.  So when are you writing a book about using Stripe's Connect platform?  I want to get my head around that next ;)

Link to comment
Share on other sites

 Share

×
×
  • Create New...