Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 表单内部的jquery花式方框预览_Php_Jquery - Fatal编程技术网

Php 表单内部的jquery花式方框预览

Php 表单内部的jquery花式方框预览,php,jquery,Php,Jquery,我使用jquery fancy box预览mysql中的数据 我用了这个例子 我想将“id=1”传递给grid.php 当我从外面经过时,我可以看到预览,因为预览在 表单值1无法传递到grid.php页面 我怎样才能做到这一点 代码如下: !DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

我使用jquery fancy box预览mysql中的数据

我用了这个例子

我想将“id=1”传递给grid.php

当我从外面经过时,我可以看到预览,因为预览在

表单值1无法传递到grid.php页面

我怎样才能做到这一点

代码如下:

!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Jose Francisco Diaz / picssel.com" />
<title>POST preview</title>
<link rel="stylesheet" type="text/css" href="fancybox2.1.4/jquery.fancybox.css" />
<style type="text/css">
 a {outline: 0 none; text-decoration: none;}
 a img {border: 0 none;}
 #wrap { width: 800px;  margin: 20px auto; font-family: arial, sans-serif; font-size: 14px;}
 .preview2 {width: 80px; padding: 5px; background: #ededed; display: block; line-height: 16px; text-decoration: none; text-align: center; border: solid 1px #ccc;}
 label {display: block}
</style>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script type="text/javascript" src="fancybox2.1.4/jquery.fancybox.js"></script>
<script>
/* <![CDATA[ */
$(document).ready(function () {
  $('.preview2').on("click", function (e) {
    e.preventDefault();
    $.ajax({
      type: "POST",
      cache: false,
      url: this.href, // preview.php
      data: $("#postp").serializeArray(),
      success: function (data) {
        // on success, post (preview) returned data in fancybox
        $.fancybox(data, {
            // fancybox API options
          fitToView: false,
          width: 905,
          height: 505,
          autoSize: false,
          closeClick: false,
          openEffect: 'none',
          closeEffect: 'none'
        }); // fancybox
      } // success
    }); // ajax
  }); // on
}); // ready
/* ]]> */
</script>
</head>
<form id="postp" method="post" action="">
        <p>
            <label for="login_name">data:
 </label>
            <input type="text" id="login_name" name="login_name" size="30" /><a class="preview2" href="grid.php" id="preview2">Preview</a>
        </p>

        <p>
            <input type="submit" value="submit" />
        </p>
    </form>
!DOCTYPE html>
后期预览
{大纲:0无;文本装饰:无;}
img{border:0无;}
#换行{宽度:800px;边距:20px自动;字体系列:arial,无衬线;字体大小:14px;}
.preview2{宽度:80px;填充:5px;背景:ededed;显示:块;线宽:16px;文本装饰:无;文本对齐:居中;边框:实心1px#ccc;}
标签{显示:块}
/*  */

数据:


缺少表单id。获取了值