0

When I use local computer using XAMPP my code is working fine but when I upload my webpage to the my InMotion Server it is not working.

Error shows

[object Object]

My Code:

$http.post("/aa/bb/public_html/php/checker.php",{"data1": val, "data2": para})
        .then(function(response) {
            if(para == "namedis"){
                $scope.dsnamedis = response.data;
            }else if(para == "namedise"){
                $scope.dsnamedise = response.data;
            }else if(para == "namein"){
                $scope.dsnamein = response.data;
            }else if(para == "namest"){
                $scope.dsnamest = response.data;
            }else if(para == "namemd"){
                $scope.dsnamemd = response.data;
            }else if(para == "namels"){
                $scope.dsnamels = response.data;
            }else if(para == "email"){
                $scope.dsemail = response.data;
            }else if(para == "pass"){
                $scope.dspass = response.data;
            }else if(para == "passc"){
                $scope.dspassc = response.data;
            }else if(para == "idno"){
                $scope.dsidno = response.data;
            }else if(para == "phoneno"){
                $scope.dsphoneno = response.data;
            }else{


            }


        }, function(error,status) {

        $scope.fstatus = { message: error, status: status};
        console.log(status); 
        });

My PHP Code:

<?php
$gc = file_get_contents("php://input");
$datas = json_decode($gc, true);
$cc = $datas['data1'];
$dd = $datas['data2'];
if($dd == "namedis"){
echo "<span class='text-danger'> <i class='fa fa-times-circle-o' aria-hidden='true'></i>aaaa.</span>";
}elseif($dd == "namedise"){

and so on

How to solve this problem.

When I remove the .htacess file it is working fine. How to work it with .htacess file.

RewriteBase /

DirectorySlash Off
DirectoryIndex disabled

RewriteEngine on

# prevent direct access to PHP files
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule \.php$ - [R=404,L]

# rewrite requests for a directory to index.php
RewriteCond %{REQUEST_FILENAME}/index.php -f
RewriteRule ^.*$ /$0/index.php [L]

Options -Indexes

ErrorDocument   403 /errors/403error.php

ErrorDocument   404 /errors/404error.php
11
  • 1
    you can't access anything above public_html directory on most hosts. That is the web root directory. Try changing url to "/php/checker.php" Commented Feb 10, 2017 at 13:19
  • yeah i already use like this but not working Commented Feb 10, 2017 at 13:26
  • In your edit you are still trying to access directories above public_html and the public_html directory iteself. You can't do that. You can only access what is inside public_html Commented Feb 10, 2017 at 13:31
  • I also tried $http.post("aa.lk/php/checker.php";,{"data1": val, "data2": para}) like this it is also not woking Commented Feb 10, 2017 at 13:34
  • what is aa.lk? Is that a directory inside public_html and inside that is a directory php? Show us the directory structure inside public_html Commented Feb 10, 2017 at 13:34

1 Answer 1

1

$http.post("/../.../public_html/php/checker.php"

This is an absolutely wrong way to make a request.

Read the basics please and welcome to the beautiful world of web developement!

Sign up to request clarification or add additional context in comments.

6 Comments

I am sorry to tell you $http.post("/../.../public_html/php/checker.php" this is not same this has somethng link this $http.post("/aaa/bb/public_html/php/checker.php"
I also tried $http.post("aa.lk/php/checker.php",{"data1": val, "data2": para}) like this it is also not woking
There should be something like $http.post("example.com/checker.php" depending on where is your site's ROOT directory
yeah it is same as above comment code but not working
Then open a Chrome Dev Tools (or any other depending on browser) and check if your request has reached the server. There should be 404 error if your url is wrong, or 200 status if request was successful. Also check response for server-side errors.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.