Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
53
rated 0 times [  56] [ 3]  / answers: 1 / hits: 15095  / 13 Years ago, wed, may 25, 2011, 12:00:00

I'm working on an existing script at the moment which uses Ajax, something I've never worked with before. I have a variable set in my javascript file which gets its value from an input field on my page. I need to use Ajax to post this to my PHP page only I've no idea where to start,



Im not sure what code you would need to see, but My javascript/AJAX code is, the variable I need to pass is 'var credoff'



$(.getPoint).click(function () {
var theid = $(this).attr(id);
var onlyID = theid.split(_);
var onlyID = onlyID[1];
var credoff = parseInt($(this).children('input.credoff:hidden').val());

$.ajax({
url: 'do.php',
type: 'POST',
data: userID= + onlyID,
success: function (data) {
if (data != success1 && data != success5) {
$(# + theid).text(data);
} else {

$(#thediv_ + onlyID).fadeOut(slow);
$('#creditsBalance').fadeOut(slow);
newbalance = parseInt($('#creditsBalance').text());


Wouldit have to be in this format?



data: userID= + onlyID,
credoff= + credoff

More From » php

 Answers
11
...
data: {
userId: onlyID,
credoff: credoff
},
...

[#92049] Tuesday, May 24, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
chase

Total Points: 78
Total Questions: 106
Total Answers: 93

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
chase questions
Thu, Mar 31, 22, 00:00, 2 Years ago
Thu, Jul 1, 21, 00:00, 3 Years ago
Sat, Dec 12, 20, 00:00, 4 Years ago
Mon, Sep 14, 20, 00:00, 4 Years ago
;