javascript - How to locate the correct link directory files in my php -
my problem links not correct says "failed load resources" in console.
both code not related. , user.php asking connection inside dbc folder database.php , myscript.js wants find user.php located inside view folder.
image of current folder file tree:
http://s38.photobucket.com/user/eloginko/media/folder_zps2d422ae2.png.html
user.php
<?php include_once('view/../dbc/database.php'); $db = new connection(); $db = $db->dbconnect(); $email = $_post['email']; $pass = $_post['password']; if(!empty($email) && !empty($pass)){ $st = $db->prepare("select * user email=? , password=?"); $st->bindparam(1, $email); $st->bindparam(2, $pass); $st->execute(); if($st->rowcount() == 1){ echo "1"; exit; } else { echo "incorrect email or password"; } }else{ echo "please enter email , password"; } ?>
myscript.js
$(document).ready(function() { $('div#show:empty').hide(); $('#login').click(function(){ var email = $('#lemail').val(); var password = $('#lpassword').val(); $.ajax({ data: { email : email, password : password }, type: "post", url: 'js/../view/user.php', success: function(data) { if (number(data) == 1) { $(".show-page[data-page=progbar]").trigger("click"); $('#mymodal').modal('hide'); } else { $('div#show:empty').show(); $('#show').html(data); } } }); return false; }); });
do following in myscript
url: '../view/user.php',
go 1 folder myscript , find view folder ,and find user.php file.
in user.php use same way
include_once('../dbc/database.php');
Comments
Post a Comment