Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6347477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:13:22+00:00 2026-05-24T21:13:22+00:00

I have a JSON Object { widgetSettings:[{maxDisplay: 6, maxPerRow: 2}], widgets: [ {wigetID: 1,

  • 0

I have a JSON Object

{ 
    "widgetSettings":[{"maxDisplay": 6, "maxPerRow": 2}],
    "widgets": [
        {"wigetID": 1, "show": false, "weight": 0, "widgetTitle": "Widget 1", "widgetColor": "defualt"},
        {"wigetID": 2, "show": false, "weight": 0, "widgetTitle": "Widget 2", "widgetColor": "defualt"},
        {"wigetID": 3, "show": false, "weight": 0, "widgetTitle": "Widget 3", "widgetColor": "defualt"},
        {"wigetID": 4, "show": false, "weight": 0, "widgetTitle": "Widget 4", "widgetColor": "defualt"},
        {"wigetID": 5, "show": false, "weight": 0, "widgetTitle": "Widget 5", "widgetColor": "defualt"},
        {"wigetID": 6, "show": false, "weight": 0, "widgetTitle": "Widget 6", "widgetColor": "defualt"},
        {"wigetID": 7, "show": false, "weight": 0, "widgetTitle": "Widget 7", "widgetColor": "defualt"},
        {"wigetID": 8, "show": false, "weight": 0, "widgetTitle": "Widget 8", "widgetColor": "defualt"},
        {"wigetID": 9, "show": false, "weight": 0, "widgetTitle": "Widget 9", "widgetColor": "defualt"},
        {"wigetID": 10, "show": false, "weight": 0, "widgetTitle": "Widget 10", "widgetColor": "defualt"},
        {"wigetID": 11, "show": false, "weight": 0, "widgetTitle": "Widget 11", "widgetColor": "defualt"},
        {"wigetID": 12, "show": false, "weight": 0, "widgetTitle": "Widget 12", "widgetColor": "defualt"},
        {"wigetID": 13, "show": false, "weight": 0, "widgetTitle": "Widget 13", "widgetColor": "defualt"},
        {"wigetID": 14, "show": false, "weight": 0, "widgetTitle": "Widget 14", "widgetColor": "defualt"},
        {"wigetID": 15, "show": false, "weight": 0, "widgetTitle": "Widget 15", "widgetColor": "defualt"},
        {"wigetID": 16, "show": false, "weight": 0, "widgetTitle": "Widget 16", "widgetColor": "defualt"} 
]}

I want to with jQuery to post that to a server side script so I can save it in a DB. And when I say save it I mean as the JSON object. However seeing as when you make a post/get other the way its posted is a JSON format my JSON that I am posting so I can save in the DB, gets lost it seems and the DB gets left with an empty value. Any ideas to what I may be doing wrong.. heres the jQuery portion.

$.post('ui-DashboardWidgetsPost.php', {"dashWidgets":dashboardJSON}, function(msg)
    {
        if(msg.error == "yes"){console.log('Error Found: '+ msg.errorMsg);}
        else
        {
        }
    });

EDIT
The PHP

<?php
$validJSON = $_POST['dashWidgets'];

mysql_connect("127.0.0.1", "", "") or die('{"error": "yes", "errormsg": "'.mysql_error().'"}');
mysql_select_db("xxxx") or die('{"error": "yes", "errormsg": "'.mysql_error().'"}');

$result = mysql_query("UPDATE dashboardPrefs SET widgetSettings='".$validJSON."' WHERE userID=100") 
or die('{"error": "yes", "errormsg": "'.mysql_error().'"}');

echo '{"error": "none"}';
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:13:23+00:00Added an answer on May 24, 2026 at 9:13 pm

    If you want to send the JSON (as string, not the actual values) to the DB, perhaps you should treat it as one?

    $.post('ui-DashboardWidgetsPost.php', {
        json: dashboardJSON
    }, function(msg) {
        msg=jQuery.parseJSON(msg);
        if (msg.error == "yes") {
            console.log('Error Found: ' + msg.errorMsg);
        } else { ... }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a json object collection of geo locations that I build in the
Hi I have a JSON object that is a 2-dimentional array and I need
I have created a json object from ruby with cobravsmongoose, however the attributes have
I have the following JSON object: { response: { status: 200 }, messages: [
say I have the following json object; {'fname':'john', 'lname':'Locke'} and the following text boxes
I have a request that returns a JSON object with a single property which
I have an AJAX application that downloads a JSON object and uses the data
I have a controller method that returns a jSON object and in one calling
I have a form field which requires a json object as its value when
Is there anything special I have to do to a JSON object before I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.