Sometimes bugs are super simple and staring you in the face. Yesterday I blogged about adding JQuery features to my Rails app, but pointed out that I had a bug. I tried so hard to resolve it yesterday to no avail. But this morning, as I was explaining my problem out loud to someone, all of a sudden the lightbulb went off. The solution to my bug was extremely simple!
My images weren't changing because of this line of code:
After using the inspect tool, I realized that it had made a call to my API and grabbed the correct image, however it was putting it in between the <img> tags instead of replacing my src attribute, which makes sense as I told JQuery to use it as text. My bad! The computer was simply listening to my orders!
This was such a simple fix that I'm embarrassed I didn't see it sooner! All I had to do was tell JQuery to replace the src attribute with the correct data!
If it were a snake, it would've bit me!