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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:25:08+00:00 2026-06-14T11:25:08+00:00

I write a script to make an ajax call here is my code function

  • 0

I write a script to make an ajax call here is my code

function ajax_post(obj) {
    obj = '#'+ obj; 

    var formData = $(obj).serializeArray();    

    $.ajax({
        url: '__core/info.php',
        type:'get',
        dataType: 'json',
        data: formData,
        success: function(resp){
            alert(resp);
        }
    })
}

and here is my info.php

$last_Res = theme::get_last_themes_desk(); //$last_Res is an array 
echo(json_encode($last_Res));

but when alert it shows return object object ….. what should i do if datatype is json should i convert it to another format ? $last_Res is an array

  • 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-06-14T11:25:09+00:00Added an answer on June 14, 2026 at 11:25 am

    In response to your comment (showing the response data, which is an array, containing a single object):

    //resp = [{"id":"2","name":"babak_theme","sh_describ":"support css3 and ie 9 ","rate":"3","time":"2"}];
    resp = resp[0];
    alert('id => ' + resp.id + ', Name => ' + resp.name);//etc...
    

    Will serve you just fine…

    $last_Res is an associative array, most likely. JS doesn’t have assoc arrays, but converts these to objects/ object literals:

    //php:
    $foo = array('foo' => 'bar');
    //in JS:
    var foo = {foo: 'bar'};
    alert(foo);//alerts [object Object]
    console.log(foo);//shows you what properties/prototypes/methods the object has
    

    That’s all there is too it. To access the data:

    for (var prop in resp)
    {//for "assoc arrays"
        if (resp.hasOwnProperty(prop))
        {
            alert(prop + ' => '+resp[prop]);
        }
    }
    for (var i=0;i<resp.length;i++)
    {//for regular arrays
        alert(i + ' => ' + resp[i])'
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jQuery script: $(document).ready(function() { $.ajax({ url: 'temp.ajax.php', type: 'GET', success:
I have the below jQuery code: $(document).ready(function () { $('#ajaxButton').click(function () { $.ajax({ url:
I want to write a javascript function, that will make an ajax request to
I write a script for a alerter service. I used php connection_status function to
So everything works perfectly, until an ajax call is made and the function is
I have a form which uses $.ajax on submit to call a bash script
I'm just trying to make a simple ajax call on click of a button
i am write some code for cascading drop down with dojo ajax first drop
Is Delphi have any ability to write script of IDE actions? I would like
write a script that takes two optional boolean arguments,--verbose‚ and ‚--live, and two required

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.