Solved

Storing response in input

Posted on 2016-08-25
4
66 Views
Last Modified: 2016-08-25
I have a response from the Facebook API I'm trying to store in an input before submit.

I set it in a var which when console logged it shows all of the data I need.

I then try to set that into the value of the input field:
$("#fbPageLikes").val(fbPageLikes);

Open in new window


But then when it inserts into the database I only see [object][object].  How can I actually show the data there?
0
Comment
Question by:N R
  • 2
  • 2
4 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 41770683
What do you see when you use alert(fbPageLikes) ?
0
 
LVL 11

Author Comment

by:N R
ID: 41770686
Alert
0
 
LVL 11

Author Comment

by:N R
ID: 41770690
In my console.log though I see this:

Console Log
0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 41770714
So it looks like fbPageLikes is a JavaScript object that contains an array named data.  The array is a collection of JavaScript objects, each with a few named elements.  You might try using JSON.stringify(fbPageLikes) in the JavaScript to make the information into a string for HTTP transport, and json_decode() in the PHP script.  After json_decode() use var_dump() to visualize the information sent by JavaScript.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now