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

  • Home
  • SEARCH
  • 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 7166161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:22:06+00:00 2026-05-28T14:22:06+00:00

Client side sends post request to php on server side. Php returns json to

  • 0

Client side sends post request to php on server side. Php returns json to client. Example:

[[“1″,”-1″],[“2″,”0”],[“3″,”0”],[“4″,”0”],[“5″,”4”],[“6″,”5”],[“7″,”3”]]

Now from the client side I have to create chart. I created chart with jQuery plugin jqPlot and Flot, but jqChart doesn’t show correctly. Here is jQuery code:

            if ($jqlib == "flot") {
                var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
                $.post('database2json.php', function(data){
                    $.plot($("#placeholder"), [d2, data]);
                },
                'json'
                );
            } else if ($jqlib == "jqchart") {
                $.post('database2json.php', function(podaci){
                    $('#placeholder').jqChart({
                        title: { text: 'Chart Title'},
                        series: [
                            {
                                type: 'line',
                                data: podaci
                            }
                        ]
                    });
                });
            }

With that code, Flot draws chart with line, and jqChart draws chart but there is not line, it’s empty chart.

How to solve this problem?

EDIT1: Here is screenshot of jqChart output:
enter image description here

On x axis it draws from 1 to 31 as expected, also y axis is ok, but there is no line.

EDIT2: @DraganMatek, mentioned that jqChart accepts pair values [x, y], where x is string, date or numeric, and y is numeric.

In the database there are both columns, with type int.

PHP code on the server side, to fetch these data is:

$result = mysql_query("select Dan, Temperatura from TEMPERATURA");
        $niz = array();
    while ($row = mysql_fetch_array($result)) {
                $niz[] = array($row['Dan'], $row['Temperatura']);  
    }

        $obj = json_encode($niz);
        echo $obj;

I don’t understand why it’s both x and y strings after sending as json. Maybe I could parse this on the client side?

EDIT3: I checked with Firebug that on client side I get this:

[[“1″,”-1″],[“2″,”0”],[“3″,”0”],[“4″,”0”],[“5″,”4”],[“6″,”5”],[“7″,”3”],[“8″,”2”],[“9″,”2”],[“10″,”1”],[“11″,”-2″],[“12″,”-2″],[“13″,”0”],[“14″,”1”],[“15″,”-2″],[“16″,”-1″],[“17″,”-1″],[“18″,”-2″],[“19″,”-1″],[“20″,”3”],[“21″,”-1″],[“22″,”0”],[“23″,”1”],[“24″,”3”],[“25″,”1”],[“26″,”1”],[“27″,”-1″],[“28″,”-1″],[“29″,”4”],[“30″,”5”],[“31″,”5”]]

Why is so? Into database there are two integers.

  • 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-28T14:22:07+00:00Added an answer on May 28, 2026 at 2:22 pm

    It seems that the jqChart needs the int as array elements and can’t deal with strings. Updated the code as given below.

    $.post('database2json.php', function(podaci){
        $.each( podaci, function(i, e) {
            podaci[i][0] = parseInt(e[0]);
            podaci[i][1] = parseInt(e[1]);
        });
    
        $('#placeholder').jqChart({
            title: { text: 'Chart Title'},
            series: [
                {
                    type: 'line',
                    data: podaci
                }
            ]
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create a PHP SOAP client that sends leads, but I have
I have the following code on the client side for retrieving data from the
I'm trying to call a server side method from client side via jQuery. My
It seems in both cases client sends a request to server and server answers,
When I send a request from JSP FORM, the server side automatically parses data
I'm trying to send a Python list in to client side (encoded as JSON).
Say I've got a client-side counter variable. When I send a request to the
I have developed a WCF WebService. On client side they are unable to send
My client wants to send email announcements and reports for customers. Now. The python-side
Can you have custom client-side javascript Validation for standard ASP.NET Web Form Validators? For

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.