Solved

Storing response in input

Posted on 2016-08-25
4
50 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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

708 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

16 Experts available now in Live!

Get 1:1 Help Now