是否可以在弹出窗口中加载另一个php文件

时间:2017-02-09 15:18:14

标签: javascript php jquery

我尝试创建一个系统,用户可以在该系统上单击链接,该链接将在同一页面的弹出窗口中加载。例如;你有像

这样的php链接

<a href='user_message.php?hash=$hash'>$username</a>

如果用户点击该链接,它可能会加载到同一页面上的弹出窗口中。请任何帮助将不胜感激。

我有我的技能 的 PHP

echo"<a href='account.php?hash=$hash>connect</a>
<script type=text/javascript>
    $('a').click(function (e) {
e.preventDefault();
$('.boxes').fadeIn('slow').load('user_connect.php?hash=$hash');
});
</script>

我相信我在prevntDefault a javascript的事实不会使这项工作成功。 请问这怎么可能

3 个答案:

答案 0 :(得分:0)

尚未测试,但应该相当容易:

$(document).on('click', 'a', function(e){
   e.preventDeafult(); //don't let browser follow the link

   var href = $(this).attr('href'); //get the href from original link
   var options = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=500,height=500";
  //Now open the popup
  window.open(href, 'NameOfTheWindow', options);
})

请记住,此代码将覆盖您页面上所有链接的行为。如果只需要在弹出窗口中打开其中一些,请添加类并在处理程序中使用它。

     $(document).on('click', 'a.js-open-in-popup', func...

答案 1 :(得分:0)

CSS:

.pop {
 display: none;
}

html:

<div id="pop" class="pop ">ur data</div>
<a href="" id="link"></a>

js:

jQuery(document).ready(function(){
 jQuery("#link").click.(function(){
  jQuery("#pop").css("display", "block");
});
});

答案 2 :(得分:0)

令人惊讶的是,我的问题中的代码确实有效。注意到我已经解决了试图解释这个问题的问题

echoed JavaScript PHP $hash JS JS script PHP .load .boxes .boxes { width: 50%; height: 50%; position: fixed; z-index: 9000; display: none; left: 25%; top: 25%; background-color: #ffffff; box-shadow: 0 0 4px #ccc; -webkit-box-shadow: 0 0 4px #ccc; -moz-box-shadow: 0 0 4px #ccc; -o-box-shadow: 0 0 4px #ccc; } { "Serilog": { "Using": ["Serilog.Sinks.Literate"], "MinimumLevel": ["Debug"], "WriteTo": [{ "Name": "LiterateConsole" }], "Enrich": ["FromLogContext"], "Properties": { "Application": "MyAppServer" } } } public class Program { public static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.Configuration(config) .CreateLogger(); } } <?php function custom_filter( $data ) { $data_lc = array_map(function($value){ return strtolower($value); }, $data); foreach ($data_lc as $keyA => $valueA) { foreach ($data_lc as $keyB => $valueB) { if ( $keyA === $keyB ) { continue; } if ( false !== strpos($valueA, $valueB) ) { if ( strlen($valueA) <= strlen($valueB) ) { unset($data[$keyA]); } else { unset($data[$keyB]); } } } } return $data; } $array = ['Amsterdam', 'Elderly people', 'Thousand students', 'Sixteen thousand students', 'Clean houses']; print_r( custom_filter( $array ) ); QGraphicsItem QGraphicsScene QTextCharFormatpixelSize()代码之外。setFontPointSize()有效。

样式 fontPointSize()

font().setPixelSize()

谢谢大家的贡献。