This is a hail Mary throw, but I appreciate any ideas that could point me in the right direction.
I had a "plugin" created for my wordpress site. I have a live site that is on a server and one that is installed locally on Xampp. This plugin works great on the live server site, but when I clone it to the locally hosted site it does not work.
I REALLY need this to work locally for many reason that I would probably bore you for explaining.
More details: When I open the Chrome console on the local site it has an error stating:
Failed to load resource: the server responded with a status of 404(Not Found) http://localhost:8080/rol/Desktop/sitefolder/htdocs/wordpress/wp-content/plugins/wpnotebook/ajax.php?_=1427163308124&action=1tabs
My thoughts is that there is an error in the coding that is making it pull from the physical folder on my computer instead of trying to pull it from:
http://localhost:8080/wordpress/wp-content/plugins/wpnotebook/ajax.php?_=1427163308124&action=1tabs
I'm just not sure of how to fix it if this is the case. Here is the code of the ajax tabs script:
jQuery(document).ready(function($) {
/*$(document).ready(function(){*/
/* This code is executed after the DOM has been completely loaded */
var dirurll = jQuery('#dirurl').val();
var bkid = jQuery('#idbook').val();
//alert(dirurll);
jQuery.ajax({
type: "GET",
url: "/"+dirurll+"/ajax.php",
data: "action="+bkid+"tabs",
cache: false,
dataType: "json",
success: function(Tabs){
jQuery.each(Tabs, function(i){
/* Sequentially creating the tabs and assigning a color from the array: */
var tab = jQuery('<li id="Tab-'+Tabs[i].tab_id+'" class="tabItem">'+
'<div class="tabTitle">'+
'<a href="#" class="tab"><span class="left"></span><div class="tabName">'+Tabs[i].name+'</div><span class="right"></span></a>'+
'</div>'+
'<div class="tabCreated">'+Tabs[i].date_created+'</div>'+
'</li>');
/* Adding the tab to the UL container: */
jQuery('#tabRow').append(tab);
});
jQuery('#tabRow').sortable({
update : function(event, ui){ // The function is called after the tabs are rearranged
// The toArray method returns an array with the ids of the tabs
var arr = jQuery("#tabRow").sortable('toArray');
// Striping the Tab- prefix of the ids:
arr = jQuery.map(arr,function(val,key){
return val.replace('Tab-','');
});
// Saving with AJAX
jQuery.get('/'+dirurll+'/ajax.php',{action:'rearrangeTabs',positions:arr,rand:Math.random()});
}
});
/* Caching the tabs into a variable for better performance: */
var the_tabs = $('.tab');
the_tabs.live('click',function(e){
/* If it is currently active, return false and exit: */
if($(this).is('.activeTab')) return false;
jQuery('#contentHolder').empty();
/* "this" points to the clicked tab hyperlink: */
currentTabID = $(this).closest('.tabItem').attr('id').replace('Tab-','');
/* Set the current tab: */
jQuery('a.tab').removeClass('activeTab');
jQuery(this).addClass('activeTab');
jQuery('#pageList').empty();
jQuery.getJSON('/'+dirurll+'/ajax.php',{"action":bkid+"pages","tab_id":currentTabID,rand:Math.random()},function(Pages){
jQuery.each(Pages, function(i){
/* Sequentially creating the pages and assigning a color from the array: */
var pageItem = jQuery('<li id="Page-'+Pages[i].page_id+'" class="pageItem">'+
'<div class="pageTitle">'+
'<a href="" id="Page-'+Pages[i].page_id+'" class="notepage">'+
'<span class="left"></span><span class="pageName">'+Pages[i].name+
'</span><span class="right"></span></a>'+
'</div>'+
'<div class="pageCreated">'+Pages[i].date_created+'</div>'+
'<div class="columns">'+Pages[i].columns+'</div>'+
'</li>');
/* Setting the page data for each hyperlink: */
pageItem.find('a').data('page','/'+dirurll+'/ajax.php'+'?action='+bkid+'lists&page_id='+Pages[i].page_id);
makeTabsDroppable();
/* Adding the tab to the UL container: */
jQuery('#pageList').append(pageItem).fadeIn('fast');
}); // close $.each(Pages)
// add link to create a new page
var newPage = jQuery(
'<li id="newPageItem">'+
'<abbr title="'+_('New Page')+'"><a href="" class="notebookIcons newPage">'+
'</a></abbr>'+
'</li>');
jQuery('#pageList').append(newPage);
makePagesDroppable();
// Make the first page the active page
clickPage(); // function located in notebook.php
jQuery('#pageList').sortable({
items : 'li.pageItem',
update : function(event, ui){ // The function is called after the tabs are rearranged
// The toArray method returns an array with the ids of the tabs
var arr = jQuery("#pageList").sortable('toArray');
// Striping the Tab- prefix of the ids:
arr = jQuery.map(arr,function(val,key){
return val.replace('Page-','');
});
// Saving with AJAX
jQuery.get('/'+dirurll+'/ajax.php',{action:'rearrangePages',positions:arr,rand:Math.random()});
}
});
}); // close $.get("ajax.php")
e.preventDefault();
})
jQuery('a.notepage').live('click',function(e){
/* "this" points to the clicked page hyperlink: */
var element = $(this);
/* If it is currently active, return false and exit: */
if($(this).is('.activePage')) return false;
/* Set the current page: */
jQuery('a.notepage').removeClass('activePage');
jQuery(this).addClass('activePage');
/* Checking whether the AJAX fetched page has been cached: */
if(!element.data('cache'))
{
/* If no cache is present, show the gif preloader and run an AJAX request: */
jQuery('#contentHolder').html('<img src="theme/default/images/ajax_preloader.gif" width="64" height="64" class="preloader" />');
jQuery.get(element.data('page'),{'rand':Math.random()},function(msg){
jQuery('#contentHolder').html(msg);
});
}
}) //close .notepage live click
/* Emulating a click on the first tab so page list is not empty: */
clickTab(); // function located in notebook.php
// Listen for click on New Tab icon
jQuery('.newTab').live('click',function(e){
addTab('newTab',0);
}); // close #newTab click
// Listen for click on Add Page icon
jQuery('.newPage').live('click',function(e){
addPage('newPage', currentTabID);
e.preventDefault();
}); // close #newTab click
} // closing ajax success:
}); // close ajax
});
function addTab(action, id) {
var dirurlll = jQuery('#dirurl').val();
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
currentDate = curr_year + "-" + curr_month + "-" + curr_date + " " + curr_hour + ":" + curr_min ;
jQuery.getJSON('/'+dirurlll+'/ajax.php',{'action':action,'id':id,rand:Math.random()},function(Tabs){
jQuery.each(Tabs, function(i){
var tabCreated = Tabs[i].date_created;
tabCreated = tabCreated.substring(0,tabCreated.length-3); // remove the seconds section from the date
/* Build the new tab and append it to the tabRow */
var tab = jQuery(
'<li id="Tab-'+Tabs[i].tab_id+'" class="tabItem">'+
'<div class="tabTitle">'+
'<a href="#" class="tab"><span class="left"></span><div class="tabName">'+Tabs[i].name+'</div><span class="right"></span></a>'+
'</div>'+
'<div class="tabCreated">'+tabCreated+'</div>'+
'</li>');
/* Adding the tab to the UL container: */
jQuery('#tabRow').append(tab);
}); // close .each loop
makeTabsDroppable();
}); // close newTab ajax call
}
function addPage(action,id) {
var dirurlll = jQuery('#dirurl').val();
var bkid = jQuery('#idbook').val();
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
currentDate = curr_year + "-" + curr_month + "-" + curr_date + " " + curr_hour + ":" + curr_min ;
jQuery.getJSON('/'+dirurlll+'/ajax.php',{'action':action,'id':id,rand:Math.random()},function(Pages){
jQuery.each(Pages, function(i){
var pageCreated = Pages[i].date_created;
pageCreated = pageCreated.substring(0,pageCreated.length-3); // remove the seconds section from the date
/* Sequentially creating the pages and assigning a color from the array: */
var pageItem = jQuery('<li id="Page-'+Pages[i].page_id+'" class="pageItem">'+
'<div class="pageTitle">'+
'<a href="" id="Page-'+Pages[i].page_id+'" class="notepage">'+
'<span class="left"></span><span class="pageName">'+Pages[i].name+
'</span><span class="right"></span></a>'+
'</div>'+
'<div class="pageCreated">'+pageCreated+'</div>'+
'<div class="columns">'+Pages[i].columns+'</div>'+
'</li>');
/* Setting the page data for each hyperlink: */
pageItem.find('a').data('page','/'+dirurlll+'/ajax.php?action='+bkid+'lists&page_id='+Pages[i].page_id);
// remove the new page and settings links so they can be added back to the end
jQuery('#newPageItem').remove();
/* Adding the tab to the UL container: */
jQuery('#pageList').append(pageItem).fadeIn('fast');
// add link to create a new page
var newPage = jQuery(
'<li id="newPageItem">'+
'<abbr title="'+_('New Page')+'"><a href="" class="notebookIcons newPage">'+
'</a></abbr>'+
'</li>');
jQuery('#pageList').append(newPage);
jQuery('#pageList').append(newPage).fadeIn('fast');
}); // close $.each(Pages)
makePagesDroppable();
}); // close newTab ajax call
}
dirurll
? Are you using WordPress AJAX?