Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
|
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 8th, 2014, 12:45 PM
Registered User
 
Join Date: Feb 2014
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default JQuery Error for Ajax

Hy i have problem getting value in ajax, I get error message in script
xhr.send( ( options.hasContent && options.data ) || null );

On what is concern this error. JQuery code is :


$(document).ready(function(){
function refreshSmallBasket(){
$.ajax({
type: 'POST',
url:'mod/basket_small_refresh.php',
dataType:'json',
success: function(data){
$.each(data, function(k, v){
$("#basket_left ." + k + " span").text(v);
});
},
error: function(data){
console.log(data.status + " " + data.statusText);
}
});
}

//if there class with name add_to_basket
if($(".add_to_basket").length > 0){
//on this class on click execute
$(".add_to_basket").click(function(){
//this click with this class
var trigger = $(this);
//add attribute rel from link
var param = trigger.attr("rel");
//split atribute with _ example rel= 2_3 we spleet 2 and 3
var item = param.split("_");

$.ajax({
type: 'POST',
url:'mod/basket.php',
dataType: 'json',
data: ({ id : item[0], job : item[1]}),
success: function(data){
var new_id = item[0] + '_' + data.job;
if(data.job !=item[1]){
if(data.job == 0){
trigger.attr("rel", new_id);
trigger.text("Remove From Basket");
trigger.addClass("red");
}
else{
trigger.attr("rel", new_id);
trigger.text("Add To Basket");
trigger.removeClass("red");
}

refreshSmallBasket();
}
},
error:function(data){
console.log(data.status + " " + data.statusText);
}
});
return false;
});
}
});





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 11 jQuery install - packages.config error AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 1 January 28th, 2014 11:55 AM
AJAX or JQUERY abhijit89 BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 April 6th, 2011 03:39 PM
Chapter 15 - JQuery Error in Genres page torr6420 BOOK: Beginning ASP.NET 4 : in C# and VB 1 May 17th, 2010 10:07 AM
call WCF Service using JQuery but without using AJAX informit BOOK: Professional WCF Programming: .NET Dev with Windows Communication Found ISBN: 9780470089842 0 February 23rd, 2009 01:33 AM
Ajax Error jezywrap C# 2005 0 July 16th, 2007 09:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.