jeudi 14 juin 2018

How to get dynamic value from DB using the qtip jquery library for evey mouse over on the image

I am using Laravel framework with qtip. I need to bring the value from DB when mouseover the Image. Different value will be feed into DB frequently. The below code has been work first time only. This is not bring the value If second time mouseover on the image.

Please assist to bring the value every time mouseover on the image.

qtip version : v3.0.3

$(".dynamic-image").qtip({       
     content: {
            text: function(event, api) {                
                $.ajax({
                        type: "POST",
                        cache: false,                           
                        encoding: "UTF-8",
                        url: "",
                        data: { soruce_id:$(this).attr('data-id')},
                })
                .then(function(content) {
                    content = 'Current Value : '+content;
                    api.set('content.text', content);
                }, function(xhr, status, error) {
                    api.set('content.text', status + ': ' + error);
                });        
                return 'Loading...'; 
            }
        },
        show: {
            effect: function() {
                $(this).fadeTo(500, 1);
            }
        },
        hide: {
            effect: function() {
                $(this).slideUp();
            }
        },
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire