Welcome Guest, Not a member yet? Register   Sign In
Have to click twice to load Ajax Data.
#5

[eluser]sbarow[/eluser]
Seems the issue was I had to bind the event handler to the links as they where created dynamically. Here is the fixed code if any one is interested.
Code:
function get_images(id) {
            $('#clicked_' + id).live('click', function() {
            
            var ajax_data = { ajax: '1'};
            
            $.ajax({
                    url: '<?php echo base_url(); ?>site/work_images/' + id,
                    type: 'POST',
                    data: ajax_data,
                    success: function(msg) {
                        $('#main_image').html(msg);
                    }
                });
                
            });
        }
        [removed]


Messages In This Thread
Have to click twice to load Ajax Data. - by El Forum - 04-09-2011, 10:09 AM
Have to click twice to load Ajax Data. - by El Forum - 04-09-2011, 10:16 AM
Have to click twice to load Ajax Data. - by El Forum - 04-09-2011, 10:17 AM
Have to click twice to load Ajax Data. - by El Forum - 04-09-2011, 10:28 AM
Have to click twice to load Ajax Data. - by El Forum - 04-09-2011, 10:41 AM
Have to click twice to load Ajax Data. - by El Forum - 04-09-2011, 10:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB