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 7633795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:59:09+00:00 2026-05-31T06:59:09+00:00

My HTML/jQuery Code <div id=divResult></div> function doSearch(str){ var jsonString = str;//$.parseJSON//JSON.stringify(str); $.ajax({ type:’GET’, url:’search.php’,

  • 0

My HTML/jQuery Code

<div id="divResult"></div>

function doSearch(str){
var jsonString = str;//$.parseJSON//JSON.stringify(str);
$.ajax({
    type:'GET',
    url:'search.php',
    data:{data:jsonString},
    success:function(data){
        for( var key in data ) {
      alert(key);
    }       
});
}

My problem is that when I tried to parse the JSON (display it) I’m not getting the expected result, The data gets displyed in a manner of per text per line eg.

The JSON data was [{“userid:1,name:paul”},{“userid:5,name:jackson”}]

The display on the browser is like this,

[
{
"
u
s
e
r
i
d
:
1

and so on so forth…

I can’t understand? is there something wrong?

I tried my js code with jsFiddle and it looks good,

I expect something like these;

1 Paul
5 Jackson

PHP Code is;

if ($stmt->execute(array("%$_GET[data]%"))) {
  while ($row = $stmt->fetch()) {    
    $aResult[] = array(
        'userid'    => $row['ui_userid'],
        'category'  => $row['ui_jocategory']
        );
        //print_r($aResult);
  }  
  echo json_encode($aResult);
}

Thanks in advance..

  • 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-31T06:59:10+00:00Added an answer on May 31, 2026 at 6:59 am

    Add dataType: 'json' to your ajax options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I have this code: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script> <script type=text/javascript> function get()
HTML code: div id=updatePanel>​ jQuery code: var data=[1, 2, 3, 4, 5, 6, 7,
I have this jquery code: var response = $(div.callbacktwo).html(result); if (response == 'Added!'){ //some
I have a jquery line of code that outputs some HTML to a div.
OK i have this code HTML: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js> </script> <script type=text/javascript>
I've got the following code: <code><html> <body><br> <script type=text/javascript src=http://code.jquery.com/jquery-1.4.2.min.js /> <script type=text/javascript> alert(debug);
I am using the following code - jQuery(.form_ + form_count).html(<div id='message'></div>) jQuery('#message').html(<center><h2><br><br>Thank You Your
Say I have jquery code like this: html += '<div class=index>' + item.index +
html code: <div> <input type=checkbox onclick=selectAll(this); />select all<br/> <input type=checkbox /><br/> <input type=checkbox /><br/>
I am using JQuery I am having below html: HTML Code: <div id=skywardsLogin style=display:

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.