Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function auth() {
- var user = {
- login: $("#login").val(),
- password:$("#password").val(),
- }
- $('#result').html('<div class="alert alert-block">Подождите...</div>');
- $.ajax({
- url: '/file.php',
- type: 'post',
- dataType: 'json',
- success: function (data) {
- $("#result").empty();
- if (data.status == 'error') $('#result').html('<div class = "alert alert-error">'+data.msg+'</div>');
- if (data.status == 'ok') $('#result').html(data.msg);
- //$('#result').html(data.msg);
- },
- });
- }
- $user = json_decode($user,true);
- if (!empty($user['login']) && !empty($user['password'])) {
- $data = array('status'=>'','msg'=>'ок, данные пришли');
- echo json_encode($data);
- } else {
- $data = array('status'=>'error','msg'=>'неправильно ввели пароль');
- echo json_encode($data);
- }
- $.ajax({
- url: '/file.php',
- type: 'post',
- data: user,
- dataType: 'json',
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement