1
mybook.push({
            pages: $("#id_pages").val()
           });

mybook.serialize()

Error:

Uncaught TypeError: Object [object Array] has no method 'serialize'

How to fix it?

6
  • 2
    what is invoiceItems Commented Feb 25, 2014 at 9:50
  • You should show how you define the variable invoiceItems. Commented Feb 25, 2014 at 9:51
  • Should you not be serializing mybook, rather than invoiceItems? Commented Feb 25, 2014 at 9:51
  • 1
    yes because this mybook is not a jQuery object, its an array. Commented Feb 25, 2014 at 9:52
  • But i think you can console.log($(mybook).serialize()) Commented Feb 25, 2014 at 9:53

1 Answer 1

1

Actually mybook is not a jQuery object,As of jQuery API you should pass it to jQuery Class then you can use the method .serialize() or .serializeArray()

console.log($(mybook).serialize())

Sign up to request clarification or add additional context in comments.

2 Comments

How to build JSON string from mybook array?

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.