Hi,
why don't you try $("#item_id").val() ??
Hope it helps,
Cheers
On Sep 13, 4:16 am, Haskabab <[email protected]> wrote:
> Hi,
>
> I've been breaking my back over the following topic for 2 hours now
> and I'm getting desperate.
> I'm trying to make a "buy item" script for my game, and for that I
> show my users a accordion-list of items, with links that open a
> information screen with jQuery. Which is working perfectly.
>
> In the information screen there is an form:
>
> <form action='' method='post'>
> <input type='text' id='amount' name='amount' value='1' />
> <input type='hidden' id='item_id' name='item_id' value='49' />
> <input type='submit' name='submit' id='submit' value='buy item!' /
>
> </form>
>
> Now what I want to happen is that whenever the button is pressed, a
> php file on the background processes the form and show a response
> text. But for that to work I need to get the "attr("value")" of the
> #item_id and #amount.
>
> And for some reason it just won't give me the attribute values. I've
> used the livequery plugin to get the response text and that is working
> so far, but the only problem I have now is that I cant get those
> attribute values.
>
> Javascript code to process the "buy this item" page:
>
> $('#buy-item').livequery('click', function(){
>
> var id = $("#item_id").attr("value");
> var amount = $("#amount").attr("value");
>
> //AJAXcall
> $.ajax({
> type: "GET",
> url: "ajaxResponders/buy_item.php",
> data: "data="+id+";"+amount,
> success: function(data){
> $('#jutsu-info').html(data);
> }
> });
>
> });
>
> The code is working except for the part where I get the attribute
> values of the #item_id and #amount.
>
> Does anyone have a clue what I should do? Thanks in advance.
> ~Haskabab
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---