1

excuse my bad english first,

im using ajax call and the code goes like this :

$.ajax({
            url:'fetch.php',
            type: 'GET',
            **data: { temp : 'counter' },**
            success: function(data){
                $('#rules2').append(data);  
        }   

The problem is that i want the counter to be a number...i gave already set it as var counter = 1; but what it does is to just send the string "counter".

Any help for this?

What i want to do is to get some data from the db with the fetch.php file and get that data by the id ...so id is a number and i need to send a number with ajax method.

Thx

1
  • 2
    it's sending a string because your creating a string. should be pointing to the variable. data: { temp : counter }, (no single quotes) Commented Nov 18, 2010 at 0:32

1 Answer 1

2
$.ajax({
    url:'fetch.php',
    type: 'GET',
    data: { temp : counter }, // Note the missing quotation marks
    success: function(data) {
        $('#rules2').append(data);  
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.