0

I just transferred my site over to a new server and I am encountering a problem.

Previously, the following would work:

var ajaxURL = 'http://www.example.com/cart/?parameter=1';
ajaxCaptureRequest = $.post( ajaxURL, { cart_action: "capture", firstName: $('#firstName').val(),  totalSub: $('#totalSub').val() }, function(data){});

Now on my new server it doesn't work. If however, I change the ajaxURL to:

var ajaxURL = 'http://www.example.com/cart/index.php?parameter=1';

it works.

For stupid reasons I cant change the code permanently like this so it has to be without the 'index.php' in the ajaxURL variable.

What settings do I need to change in order to get this done?

  • why are you sending two `cart_action` to the php? and are you using somekind of php MVC framework? – Jai Jan 05 '15 at 08:39
  • That was a mistake. I changed my real code to make the example more concise. I have corrected that now though. You can assume the parameter is not redundant. No framework is being used. – Josh Miller Jan 05 '15 at 08:43
  • if there is no framework at your site then how the url should know about sending the query string to which file? In short there is no way of doing it. – Jai Jan 05 '15 at 08:45
  • well is it `input_type=ajax` or `cart_action=ajax`? You should check to see where your requests are landing – Spokey Jan 05 '15 at 08:49
  • I am sorry I made a mistake with the code, so I cleaned up the example code again. My apologies. – Josh Miller Jan 05 '15 at 09:02
  • This code was working on my previous server, just when I switched over it stopped working. There must be some kind of server setting to change so that it works. I assumed it works as index.php is the directory index. Just like if you go to www.example.com/cart it will take you to www.example.com/cart/index.php (assuming it exists), so too, index.php will be the assumed destination in this case. That was how I presumed it was working till now. – Josh Miller Jan 05 '15 at 09:08

1 Answers1

0

if you are using anyframeworks or whatever you could remove the occurance of index.php as mention in the periovus stackoverflow answers

URL :: https://stackoverflow.com/a/4365161/4119740

you could write the following lines in .htaccess file

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

Hope This Solves your problem

Community
  • 1
  • 1
Farveen Hassan
  • 408
  • 4
  • 12