问题
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