Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <script src="/public/scripts/jquery.min.js"></script>
- <script src="/public/scripts/jquery.cookie.js"></script>
- <title>AJAX</title>
- <style>.red{background:red}</style>
- </head>
- <body>
- <form method="post" action="set.php" id="formId">
- <input type="text" name='fio'>
- <input type="text" name='place'>
- <button type="submit">ะคะะ</button>
- </form>
- <script>
- $(function(){
- $("#formId").submit(function(){
- var form_data = $("#formId").serialize();
- $("input","#formId").removeClass("red");
- var is_valid = valid_form();
- $.ajax({
- type: "POST",
- url: "set.php",
- dataType: "json",
- data: ({a : '55'}),
- success: function( data ){
- for(el in data){
- $("input[name='"+data[el]+"']").addClass("red");
- }
- }
- });
- return false;
- })
- })
- function valid_form(){
- return false;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement