Can anyone help me understand why the ajax statement in my code does not accept the '-' symbol? I've had issues with this before and ended up modifying a lot of things on the backend of my site to use '_' instead, which worked. Is there a way to force the ajax script to recognize the '-' symbol?
$("#events").append("<img src='"+data[i]['event-image']+"'></a>");
This snippet is from an AJAX call intended to fetch JSON data that my website is generating. The field name I'm trying to access is "event-image". However, the console is displaying an error indicating it cannot find "image". It seems that the dash is causing the code to skip the first part "event-". Any suggestions on how I can fix this without changing the field to "_"? Your feedback would be greatly appreciated!