使用JQuery.Load()函数在DIV标记中加载时,表单不起作用。

时间:2014-04-08 08:43:47

标签: jquery

我的问题是,当我尝试将一个HTML表单NESTED加载到一个div,在一个现成的页面上。提交无效。 但如果加载它在一个新的页面,它工作正常。

似乎无法弄清楚出了什么问题。所以,希望你们能帮助我,让这个工作。

代码生病了:

**My Jquery script** 

<script type="text/javascript">

            ;(function($){

                $('a').click(function(){

                    var href = $(this).attr('href')+'#content';

                    $('#load').load(href);

                    return false; 
                });

            })(jQuery);

        </script>

我试图加载的表单是。

 <div id="content">
      <form id ="profil" action="upload_file.php" method="post" enctype="multipart/form-     data">
      <label for="file">Filename:</label>
      <input type="file" name="file" id="file"><br>
      <input type="submit" name="submit" value="Submit">
      </form>*


   My code for the front page:




  <?php

   include 'db_connect.php';  
    include 'functions.php';

  sec_session_start();

   if(login_check($mysqli) == true) {


   $_SESSION['user_id'] = $user_id;

  if (!file_exists("brugere/$user_id")) {
  mkdir("brugere/$user_id", 0777, true);
 }







     //echo "<p>Success: You have been logged in!<p>";

      // Add your protected page content here!

     ?>
    <html>
    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Oktoberfesttur.dk</title>

    <link rel="shortcut icon" href="pictures/favicon/favicon.ico"/>

    <link rel="stylesheet" type="text/css" href="background.css"/>
    <link rel="stylesheet" type="text/css" href="design.css"/>
    <link rel="stylesheet" type="text/css" href="dropdownfront.css"/>
    <link rel="stylesheet" type="text/css" href="indhold.css"/>
    <link rel="stylesheet" type="text/css" href="login.css"/>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
    <script type="text/javascript" src="sha512.js"></script>
    <script type="text/javascript" src="forms.js"></script>
    <script type="text/javascript" src="slideshow.js"></script>

</head>
<body class="background">






    <p class="oktoberfestfont">Oktoberfest</p>

    <div class="topleft">

    </div>


    <div id="slideshow">
<img src="pictures/slideshow2/01.jpg?<?php echo Time () ?>" alt="" class="active" />
<img src="pictures/slideshow2/02.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/03.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/04.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/05.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/06.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/07.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/08.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/09.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/10.jpg?<?php echo Time () ?>" alt="" />
<img src="pictures/slideshow2/11.jpg?<?php echo Time () ?>" alt="" />
    </div>



    <div class="loginbox">

    <div class="login">
        <center>
            <form class="contact_form" action="process_login.php" method="post" name="login_form">
                Log in <input type="text" name="email" placeholder="  Email"/><br />
                    <br />
                       <input type="password" name="password" id="password" placeholder="  Password"/><br />
                    <br />
                <button class="submit" type="submit" onclick="formhash(this.form, this.form.password);" >Login</button>
            </form>
            <form action="reg.php" method="post" name="reg_form">
                <button class="submit" type="submit" name="submit">Registration</button>
            </form>
        </center>
    </div>
</div>


    <div class="nav">
        <ul>

            <li><a href="oktoberfest" class="menutext">Oktoberfest</a>
                <ul>
                    <li><a href="forsideindhold/wiesn.php" class="undermenutext">Wiesn</a></li>
                    <li><a href="forsideindhold/oktoberfest.php" class="undermenutext">Oktoberfest</a></li>
                    <li><a href="forsideindhold/munchen.php" class="undermenutext">München</a></li>
                </ul>
            </li>
            <li><a href="forsideindhold/priser.php" class="menutext">Priser</a></li>
            <li><a href="logindhold/galleri.php" class="menutext">Billeder</a></li>
            <li><a href="forsideindhold/kontakt.php" class="menutext">Kontakt os</a>  </li>
            <li><a href="Profil" class="menutext">Profil</a>
                <ul>
                    <li><a href="logindhold/profil.php" class="undermenutext">Min Profil</a></li>
                    <li><a href="logindhold/mitbilled.php" class="undermenutext">Mit Billed</a></li>
                    <li>
                            <form action="logout.php" method="post" name="login_form">
                            <button class="subbut" type="submit" name="submit">&nbsp;Log out</button>
                            </form>
                    </li>
                </ul>
            </li>

    </div>



    <div id="sideleftid"  class="sideleft">

        <a href="forsideindhold/mad.php" id="7" class="leftpic">
            <img src="pictures/mad/01.jpg?<?php echo Time () ?>" alt="" />


            <h1 class="madh1">Bayerische Spezialitäten</h1>

        </a>
    </div>



    <div id="load" class="midt">






    </div>

    <div class="bund"></div>

     <div class="sideright"></div>




     <script type="text/javascript">

        ;(function($){

            $('a').click(function(){

                var href = $(this).attr('href')+'#content';

                $('#load').load(href);

                return false; 
            });

        })(jQuery);

    </script>








</body>

 <?php

 } else {
 echo 'You are not authorized to access this page, please login. <br/>';
 }


   ?>

   */                

然后jQuery应该从som其他网站加载内容,其中有一个表单我的内容。


       

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript"      src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>


</head>

<body>


    <div id="content">



                <form id ="probil" action="upload_file.php" method="post"
                enctype="multipart/form-data">
                <label for="file">Filename:</label>
                <input type="file" name="file" id="file"><br>
                <input type="submit" name="submit" value="Submit">
                </form>







        <div class="mitbilled">
        <p>
            Mit billed
        </p>
        </div>


    </div>

</body>

0 个答案:

没有答案