atwebmaster Posted March 26, 2016 Share Posted March 26, 2016 Hi everyone im trying to create a new user through a javascript code using ajax method but im getting an error "An error occured:0" this is the javascript code of my register.html file : <script> $(function(){ $('.RegisterBtn').click(function () { $('#RegisterTermUse').modal('show'); $( ".btn-confirm" ).click(function( event ) { //document.getElementById("register").submit(); var password = $('#confirmpassword').val(); var email = $('#email').val(); var lastname = $('#lastname').val(); var firstname = $('#firstname').val(); //var person = {"customer":{"id_default_group":3,"passwd":password,"lastname":lastname,"firstname":firstname,"email":email,"active":1[spam-filter]; $.ajax({ type:"POST", url: "http://[email protected]/api/customers?schema=blank", contentType: 'application/json; charset=utf-8', dataType: 'json', data: {"customer":{"id_default_group":"3","passwd":password,"lastname":lastname,"firstname":firstname,"email":email,"active":"1"[spam-filter], success: function(data) { console.log(data); }, error: function(xhr) { //something went wrong, handle the error and display a message alert("An error occured: " + xhr.status + " " + xhr.statusText); } }); }); }); }); </script> Your help is appreciated . Thx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now