This site uses cookies from Google to deliver its services, to personalize ads and to analyze traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies. Learn More

Jquery Ajax Using Fancybox Jquery Plugins

Jquery Ajax Using Fancybox Jquery Plugins Web-development (PHP) Jquery Ajax Using Fancybox Jquery Plugins

Jquery Ajax Using fancybox jquery plugins
Jquery Ajax Using fancybox jquery plugins

Download



<link type="text/css" href="styles.css" /> <link type="text/css" href="fancybox/jquery.fancybox-1.2.6.css" media="screen" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> <script type="text/javascript" src="fancybox/jquery.fancybox-1.2.6.pack.js"></script> <script> $(document).ready(function(){ $("#addButton").fancybox({ 'zoomSpeedIn' : 600, 'zoomSpeedOut' : 500, 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack', 'hideOnContentClick': false, 'padding' : 15 }); /* The submit button: */ $('#note-submit').live('click',function(e){ if($('.pr-body').val().length<4) { alert("The note text is too short!") return false; } if($('.pr-author').val().length<1) { alert("You haven't entered your name!") return false; } $(this).replaceWith('<img src="img/ajax_load.gif" />'); var data = { 'body' : $('.pr-body').val(), 'author' : $('.pr-author').val() }; /* Sending an AJAX POST request: */ $.post('post.php',data,function(msg){ $("#addButton").fancybox.close(); }); e.preventDefault(); }) $('.note-form').live('submit',function(e){e.preventDefault();}); }); </script> <a href="add_note.html">Add a note</a> 
//add_note.html <h3>Add a new note</h3> <div> <form action="" method="post"> <label for="note-body">Text of the note</label> <textarea name="note-body" cols="30" rows="6"></textarea> <label for="note-name">Your name</label> <input type="text" name="note-name" value="" /> <a href="">Submit</a> </form> </div> 
//post.php <?php error_reporting(E_ALL^E_NOTICE); require "connect.php"; $author = mysql_real_escape_string(strip_tags($_POST['author'])); $body = mysql_real_escape_string(strip_tags($_POST['body'])); /* Inserting a new record in the notes DB: */ mysql_query(' INSERT INTO notes (text,name) VALUES ("'.$body.'","'.$author.'")'); ?> 

0 Response to "Jquery Ajax Using Fancybox Jquery Plugins"

Posting Komentar

Contact

Nama

Email *

Pesan *