Tuesday, 15 April 2014

javascript - Ajax cant find php file.. Why? -



javascript - Ajax cant find php file.. Why? -

i trying create ajax-login-form, jquery-script cant find php file. in same directory (!), doesn't work.

my php-file (logreg.php)

<?php echo 'true'; ?>

my script-file (logreg.js)

$("button[action=\"register\"]").click(function(){ var username = $("#login-username").val(); var password = $("#login-password").val(); var repassword = $("#login-repassword").val(); $.ajax({ type: "post", url: "logreg.php", data: "name="+username+"&pass="+password+"&repass="+repassword, success:function(html){ if(html=='true'){ } }, beforesend:function(){ $("button[action=\"register\"]").text("sendet ..."); }, error: function(ts) { $("div#content").html(ts.responsetext); } }); });

why isnt working? getting everytime "error 404" (not found).

they in same directory

urls relative html document not javascript file.

javascript php jquery ajax

No comments:

Post a Comment