Jump to content

ajax with subfolders path faild


linuxfreakphp
Go to solution Solved by linuxfreakphp,

Recommended Posts

i have a problem with the path. i even tried put  the js and the php in the folder,but the js don't find the php.

 

the js is working but it is isn't find the php page and i don't know why.

i check with

<?php
echo '<script language="JavaScript">alert("1");</script>';
?> 

with the address in the browser: 'http://127.0.0.1/folder/private/php/index.php' and the php page is fine.

 

127.0.0.1

               folder

                        index.html - html file

                        private - folder

                                  php

                                        index.php - ajax js file

                                  js

                                        index.js - ajax js file

the path  i have gave to the js file:

'./../php/index.php' (work in other models of ajax i have)

'http://127.0.0.1/folder/private/php/index.php' is working fine if i'm insert it to the browser.

 

i even tried when i put the files (js and php) in the same folder as html, but it is n't working in this model.

127.0.0.1

               folder

                        index.html - html file

                        index.php - ajax js file

                        index.js - ajax js file

the path  i have gave to the js file:

'index.php'

 

what is the problem?

Edited by linuxfreakphp
Link to comment
Share on other sites

  • Solution

Give it the full absolute path, not a relative path.

hey, i found what was my problem in this model.

the path i gave was from the javascript to the php, but the reference to the php need be to the html file and not to the js file.

once i set the path in the external js file so the path will be from the html to the php and not the js file the problem solve.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.