$('.showprayer').click( function(event)
{
$.post('/show_prayer', { 'name' : $(this).text() }, function(data)
{
eval(data);
});
});
The jQuery function above returns the following string as the ajax response coming back from the server:
'#prayer_date'.html("03/19/1968");
Someone seeing this code earlier responded that "returning javascript instead of JSON is a terrible way of using Ajax"
.
My problem is, I thought this was the only way of doing it.
So if someone could enlighten me . . . if I wanted to do the same thing by returning JSON, what would that look like and would it involve significantly more code than my current ajax response which very succinctly changes the value of the prayer_date
element to its new date value?