Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 8th, 2014, 12:45 PM
Registered User
Points: 37, Level: 1
Points: 37, Level: 1 Points: 37, Level: 1 Points: 37, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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;
});
}
});
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 10: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 12:33 AM
Ajax Error jezywrap C# 2005 0 July 16th, 2007 09:11 AM



All times are GMT -4. The time now is 07:19 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.