jQuery/PHP .ajax() request not processing -


i'm trying insert user database using jquery , php. php file has been tested seperately , works fine, javascript variables before ajax request work fine well.

any appreciated!

ajax.js

$(document).ready(function(){  $("#add-user-btn").click(function() {  var email = $("#email").val(); var name = $("#name").val(); var password = $("#password").val(); var pass = hex_sha512(password); var random_number = math.floor((math.random()*1000)+1); var salt = hex_sha512(random_number); var p = hex_sha512(pass+random_number); var action = "adduser";  $(function ()  { $.ajax({             url: '../actions.php',                     type: 'post',             data: {       action:action,       email:email,       name:name,       password:p,       salt:salt,       authorization:authorization       },                           datatype: 'json',                  success: function(data)            {       $(".close-reveal-modal").click();   } }); }); }); }); 

actions.php

if($_post['action'] == "adduser"){ $email = $_post['email']; $name = $_post['name']; $password = $_post['password']; $salt = $_post['salt']; $domain = "level"; $authorization = $_post['authorization'];  $query = "insert users (email, username, password, salt, domain, level) values ('$email', '$name', '$password', '$salt', '$domain', '$authorization')";  $mysqli->query($query); } 

also tried adding following @ end of php file, no avail.

$resp = new stdclass(); $resp->success = false; if($result) {     $resp->success = true; }  print json_encode($resp); 


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -