He probado con --$("#name").val("");--, durante la respuesta q recibe del archivo php, pero no funciona, y la verdad es q no si esta bien puesto.
Código HTML:
<!doctype html> <html lang="en"> <head> <title>jQuery UI Dialog - Modal form</title> <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" /> <script type="text/javascript" src="../../jquery-1.3.2.js"></script> <script type="text/javascript" src="../../ui/ui.core.js"></script> <script type="text/javascript" src="../../ui/ui.draggable.js"></script> <script type="text/javascript" src="../../ui/ui.resizable.js"></script> <script type="text/javascript" src="../../ui/ui.dialog.js"></script> <script type="text/javascript" src="../../ui/effects.core.js"></script> <script type="text/javascript" src="../../ui/effects.highlight.js"></script> <script type="text/javascript" src="../../external/bgiframe/jquery.bgiframe.js"></script> <link type="text/css" href="../demos.css" rel="stylesheet" /> <style type="text/css"> body { font-size: 62.5%; } label, input { display:block; } input.text { margin-bottom:12px; width:95%; padding: .4em; } fieldset { padding:0; border:0; margin-top:25px; } h1 { font-size: 1.2em; margin: .6em 0; } div#users-contain { width: 350px; margin: 20px 0; } div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; } div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; } .ui-button { outline: 0; margin:0; padding: .4em 1em .5em; text-decoration:none; !important; cursor:pointer; position: relative; text-align: center; } .ui-dialog .ui-state-highlight, .ui-dialog .ui-state-error { padding: .3em; } </style> <script type="text/javascript"> $(function() { var name = $("#name"), email = $("#email"), password = $("#password"), allFields = $([]).add(name).add(email).add(password), tips = $("#validateTips"); function updateTips(t) { tips.text(t).effect("highlight",{},1500); } function checkLength(o,n,min,max) { if ( o.val().length > max || o.val().length < min ) { o.addClass('ui-state-error'); updateTips("Length of " + n + " must be between "+min+" and "+max+"."); return false; } else { return true; } } function cargad(){ $("#info").load('http://192.168.1.129:8080/c/index.php/noticias/pver/FTJgN:9j9n53X:g8dxgevQLO:4t44Imt2th6umGYACFoju:6sr3d3', {limit:2} ); }; $(document).ready(function(){ cargad(); setInterval( cargad, 5000 ); }); function checkRegexp(o,regexp,n) { if ( !( regexp.test( o.val() ) ) ) { o.addClass('ui-state-error'); updateTips(n); return false; } else { return true; } } $("#dialog").dialog({ bgiframe: true, autoOpen: false, height: 300, modal: true, buttons: { 'Create an account': function() { var bValid = true; allFields.removeClass('ui-state-error'); bValid = bValid && checkLength(name,"username",3,16); bValid = bValid && checkLength(email,"email",3,80); bValid = bValid && checkLength(password,"password",5,16); bValid = bValid && checkRegexp(name,/^[a-z]([0-9a-z_])+$/i,"Username may consist of a-z, 0-9, underscores, begin with a letter."); // From jquery.validate.js (by joern), contributed by Scott Gonzalez: [url]http://projects.scottsplayground.com/email_address_validation/[/url] bValid = bValid && checkRegexp(email,/^[a-z]([0-9a-z_])+$/i,"Username may consist of a-z, 0-9, underscores, begin with a letter."); bValid = bValid && checkRegexp(password,/^([0-9a-zA-Z])+$/,"Password field only allow : a-z 0-9"); if (bValid) { $.post('http://192.168.1.129:8080/c/index.php/link/ajax/', {pid:name.val(), em:email.val(), dr:password.val()}, function(datos) { $('#users tbody').append(datos); $('name').val(""); }); $(this).dialog('close'); } } }, }); }); $(document).ready(function() { $().ajaxStart(function() { $('#loading').show(); $('#result').hide(); }).ajaxStop(function() { $('#loading').hide(); $('#result').fadeIn('slow'); }); $('#form, #fat, #fo3').submit(function() { $.ajax({ type: 'POST', url: $(this).attr('action'), data: $(this).serialize(), success: function(data) { $('#result').html(data); } }) return false; }); $('#fo2').submit(function() { $.ajax({ type: 'POST', url: $(this).attr('action'), data: $(this).serialize(), success: function(datos) { $('#users tbody').append(datos); } }) return false; }); }); </script> </head> <body> <div class="demo"> <div id="dialog" title="Create new user"> <p id="validateTips">All form fields are required.</p> </div> <div id="info"></div> <div id="users-contain" class="ui-widget"> <h1>Existing Users:</h1> <table id="users" class="ui-widget ui-widget-content"> <thead> <tr class="ui-widget-header "> <th>Name</th> <th>Email</th> <th>Password</th> </tr> </thead> <tbody> <tr> <td>John Doe</td> <td>[email protected]</td> <td>johndoe1</td> </tr> </tbody> </table> </div> <form method="post" action="http://192.168.1.129:8080/c/index.php/link/ajax/" id="fo2" name="fo2" onSubmit="clear()" > <fieldset> <label for="name">Name</label> <input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" /> <label for="email">Email</label> <input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all" /> <label for="password">Password</label> <input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" /> <input type="text" id="f2f" value=""> <input type="submit" id="login" value="Login" name="login"/> </fieldset> </form> <button id="create-user" class="ui-button ui-state-default ui-corner-all">Create new user</button> <form method="post"> <input type="button" value="Reload Window"> </form> </div><!-- End demo --> <div class="demo-description"> <p>Use a modal dialog to require that the user enter data during a multi-step process. Embed form markup in the content area, set the <code>modal</code> option to true, and specify primary and secondary user actions with the <code>buttons</code> option.</p> </div><!-- End demo-description --> </body> </html>
Si alguien puede ayudarme se lo agradeceria mucho ^^