Ajax error: Edit the path in jcart.js to fix


I am getting an error on a page that has a shopping cart script in it.

Error: ‘Ajax error: Edit the path in jcart.js to fix.’

The issue, as far as I can tell, is around relative paths from files. I’ve tried all sorts of variations to getting the path correct to no avail.

The error is specific to a file path location variable in a JavaScript file called jcart.js. The location of the files are as follows:

Files/Directories:

  1. domain.com/folder/jcart/js/jcart.js
  2. domain.com/folder/jcart/config-loader.php
  3. domain.com/folder/jcart/relay.php

 

var JCART = (function() {

// This script sends Ajax requests to config-loader.php and relay.php using the path below
// We assume these files are in the 'jcart' directory, one level above this script
// Edit as needed if using a different directory structure
var path = 'jcart',
container = $('#jcart'),
token = $('[name=jcartToken]').val(),
tip = $('#jcart-tooltip');

var config = (function() {
    var config = null;
    $.ajax({
        url: path + '/config-loader.php',
        data: {
        "ajax": "true"
        },
        dataType: 'json',
        async: false,
        success: function(response) {
            config = response;
        },
        error: function() {
            alert('Ajax error: Edit the path in jcart.js to fix.');
        }
    });
    return config;
}());



change var path = ‘jcart’, to var path = ‘folder/jcart’,

Since the actual ajax request would be made to “window.location.href + path + ‘/config-loader.php'”, you might as well set your url parameter as:

url: location.protocol + “//” + location.host + “/folder/jcart/config-loader.php”,

Satu Tanggapan

  1. Aku tidak mengerti tentang bahasanya.saya ingin sekali

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: