Reload popup with query sql Jquery

感情迁移 提交于 2019-12-12 03:00:28

问题


I need help for ma animals website

I need launch a popup (it's ok)

<input type='submit' rel="0" data-target="_blank"  class='refresha' id='refresha' value=' Lancer protec animaux' /> 

and Jquery

$(document).on('click', '.refresha', function(e) {
    var url = //How take url in a php file with a query ?
    var windowName = $( this ).data( 'id' );
    var windowSize = windowSizeArray[$(this).attr("rel")];
    windowvote = window.open(url, windowName, windowSize);
    windowvote.moveTo(600, 0);  
    var timer = setInterval(function() {   
        if(windowvote.closed) {                             
            $("#protecAnimaux").val('fenêtre fermée avant 10 secondes...');
            clearInterval(timer);  
        }else{
            // After timer, i need popup is reload with a new link obtain by the php file with the query sql.
            $.ajax({
                type: "POST",
                url: "link.php",
                data: url,
                success: function(){    
                    windowvote.reload();   
                }
            });

            $("#protecAnimaux").val('fiche animaux test!!');
            clearInterval(timer);
        }  
    }, 3000); 
}); 

After timer, i need popup is reload with a new link obtain by the php file with the query sql.

Many thanks for your Help.


回答1:


I can answer on question which is hidden in the code:

var url = //How take url in a php file with a query ?

You can store url in you input tag:

<input type='submit' data-url=<?=$urlFromPhp?> rel="0" data-target="_blank"  class='refresha' id='refresha' value=' Lancer protec animaux'/>

And you can get it in jQuery this way:

$(document).on('click', '.refresha', function(e) {
  var url = $(this).data('url');
  ...


来源:https://stackoverflow.com/questions/35378202/reload-popup-with-query-sql-jquery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!