-1

I recently changed some stuff on my website and i have just realised that an ajax script stopped working. I paid someone to code it so i really don't know how to debug it.

First here's how it's supposed to look. If you click on a color, an AJAX script will call a PHP script to check the stock status for the selected color. If the answer is positive then the script will change the tshirt image to display the appropriate color.

The script works perfectly, but as soon as I use the same script on a subdomain it doesn't work. Here's an example of the same script on a subdomain. The image won't change when a color is clicked.

I tried looking into Firefox Console but i can't find anything relevant.How can i find what's wrong ? Why the image doesn't change on the second link i provided ?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
libertaire
  • 855
  • 3
  • 13
  • 33
  • lol my question DOES "Include attempted solutions, why they didn't work, and the expected results" but moderators still closed it for these reasons ??? wtf – libertaire Dec 26 '13 at 22:58
  • I opened your post to see your 'editing' with supposedly code and attempted solutions, but i see nothing in the history. Perhaps you can re-edit your question. It will be queued for revision than maybe re-opened. – Milche Patern Dec 27 '13 at 00:45

3 Answers3

1

Second link has an error of "Origin http://hooded-sweatshirts.ni-dieu-ni-maitre.com is not allowed by Access-Control-Allow-Origin."

Refer: Origin is not allowed by Access-Control-Allow-Origin

Community
  • 1
  • 1
user2943773
  • 254
  • 1
  • 4
  • 10
0

Ajax call not work cross domain..

Below thread may help you.. Cross-domain $.ajax request is not working

Community
  • 1
  • 1
AmitK
  • 120
  • 1
  • 6
0

I have found three problem on initial checkout of both your sites.

1 ) If you notice from the subdomain the request is going to the live site i.e https://www.ni-dieu-ni-maitre.com/tshirt_ajax.php?checkshop=429942&checkproducttype=111&stockcolor=5&currentsize=3

This should fetch the data from the subdomain site itself, so this url might be hardcoded somewhere in the script.

2 ) Script is trying to load the image from https to http and thus continuously giving error

3 ) Most of the js are loading from the live site onto sub-domain one and also might be a cause for the error occurring to your site.

try differentiating your test domain from live site i.e try not to call live resources from your test domain.. whether they are js or AJAX requests.

Regards

Sunil Verma
  • 2,490
  • 1
  • 14
  • 15