- This topic has 6 replies, 2 voices, and was last updated 13 years, 4 months ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- The forum ‘Generic’ is closed to new topics and replies.
Events Made Easy › Forums › Generic › Broken map when using AJAX pane for event details
I’ve set up a two-column arrangement for my events-list, using a bit of jquery AJAX to populate the second column with the event details. This works well. However, when I try to include a map, it doesn’t work.
For some reason the wp_footer() call wasn’t bringing in the eme map script, so I enabled ‘always include js in header’, which has included the scripts, but hasn’t solved the problem.
I have no errors showing in my js error console.
See the page here:
http://thesuitcasecinema.co.uk/test-events-page/
The first event is the one that has the map. Thanks for any help.
Do you use the #_MAP placeholder? Currently not enough info here …
Hi Franky,
Thanks for your reply.
Here is the code for the single event format:
<p>#j #M #Y - #H:#i</p><p>#_TOWN</p><p>#_NOTES</p>
#_MAP
And also the code for the AJAX request, in case it’s helpful:
function ajax_return_eme_event_details() {
check_ajax_referer("nonce-string", "security");
$event_id = $_POST;
$event = eme_get_event( $event_id );
$single_event_format = ( $event != '' ) ? $event : get_option('eme_single_event_format' );
$page_body = eme_replace_placeholders ( $single_event_format, $event );
echo $page_body;
die();
}
Well, if you use ajax queries, make sure that the html gets escaped. That doesn’t seem to be happening here. I have a few functions for that in the code (can’t check it from here though).
ok, have escaped that $_POST – thank you for pointing that out.
fixed this one – just added loadMapScript();
to the AJAX callback and everything now works, ie:
jQuery.post("<?php echo get_bloginfo('siteurl'); ?>/wp-admin/admin-ajax.php", data, successFunction);
…etc…
function successFunction(result, resultString) {
jQuery('div#event-details').html( result );
loadMapScript();
}
Sorry, I thought it already did. Glad to hear though!