Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-03-2009, 05:24 AM   PM User | #1
dniwebdesign
Regular Coder

 
dniwebdesign's Avatar
 
Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 838
Thanks: 15
Thanked 9 Times in 9 Posts
dniwebdesign is an unknown quantity at this point
Question $.get ajax and storing in a variable....

ATM, I have:
Code:
$.get("../ajax/Invoices.php?function=getCreditcustomerid="+clientid, function(busy) {
	alert(busy);
}
);
Which, in turns alerts nothing. Not very spectacular. The ajax is suppose to return the credit (ie: +6.25 or -105.23) or debt the client has.

I would like to store this in a variable so I can manipulate it and add it to other sections of the page (as this is a page for creating an invoice). However I am having no luck, after searching through the api and tutorials. This seemed to the be way to do it but alas I say again. Alerts nothing. Any idea what I am doing wrong and how to make it right. Thanks.

Note: I am using jQuery.
__________________
Dawson Irvine
CEO - DNI Web Design
http://www.dniwebdesign.com

Last edited by dniwebdesign; 06-03-2009 at 05:36 AM.. Reason: I am using jQuery.
dniwebdesign is offline   Reply With Quote
Old 06-03-2009, 03:03 PM   PM User | #2
Eldarrion
Regular Coder

 
Join Date: Feb 2009
Location: Wheeling, IL
Posts: 358
Thanks: 5
Thanked 62 Times in 60 Posts
Eldarrion is on a distinguished road
Seems to work fine on my end. Are you sure you're tossing in the proper get variables for your script to return anything? I'm guessing that you need an ampersand somewhere in there:

"../ajax/Invoices.php?function=getCredit&customerid="+clientid,

Then again, I might be wrong, but... you do know that jQuery get can also send the required variables on it's own too, right? You could always try the following:

Code:
$.get('../ajax/Invoices.php',
	{
		function: 'getCredit',
		customerid: clientid
	}, 
	function(busy) {
		alert(busy);
	}
)
See how that works for you. Additionally, consider getting FireBug and seeing exactly what the php script throws back your way.
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

How to ask smart questions?
Eldarrion is offline   Reply With Quote
Old 06-03-2009, 10:28 PM   PM User | #3
dniwebdesign
Regular Coder

 
dniwebdesign's Avatar
 
Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 838
Thanks: 15
Thanked 9 Times in 9 Posts
dniwebdesign is an unknown quantity at this point
After all the searching, frustration, face palming, it was just because I missed the ampersand. Guess I should have gone to bed earlier...

I'll keep the other method in mind as I will be calling other things as well. Thanks for your help.
__________________
Dawson Irvine
CEO - DNI Web Design
http://www.dniwebdesign.com
dniwebdesign is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:36 AM.


Advertisement
Log in to turn off these ads.