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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:23:14+00:00 2026-05-25T11:23:14+00:00

Q1. How can convert [object Object] to word? LIKE: [object Object] =to=> salam Q2.

  • 0

Q1. How can convert [object Object] to word?
LIKE: [object Object] =to=> salam

Q2. How can append outputs result search[after click on it] in class .list with(mid) tow input.
LIKE: If resulet search was value salam and after click on it get as:

EXAMPLE:

[object Object] -> input ... & input ...    
[object Object] -> input ... & input ...
[object Object] -> input ... & input ...

Js:

$('.auto_complete').keyup(function () {
    var dataObj = $(this).closest('form').serialize();
    $.ajax({
        type: "POST",
        dataType: 'json',
        //url: 'http://binboy.gigfa.com/admin/tour_foreign/auto_complete',
        url: 'auto_complete',
        data: dataObj,
        cache: false,
        success: function (data) {
            var id_name = $('.list_autobox_hotel').attr('id');
            $('.list_autobox_hotel').show().html('');
            if (data == 0) {
                $('.list_autobox_hotel').show().html('<p><b>there is no</b></p>');
            } else {
                $.each(data, function (index, value) {
                    $('<p id="' + value.name + '">' + value.name + '</p>').appendTo('.list_autobox_hotel');
                });
                //////////////////////*HERE Q1//////////////////////
                $('.list_autobox_hotel p').bind("click", function (e) {
                    e.preventDefault();
                    var ac = $(this).attr('id');
                    var ok = $.grep(data, function (e) {
                        return e.name == ac;
                    })[0].units;
                    //alert(ok);
                    /////////////*HERE Q2//// for append////////
                    $(ok).appendTo('.list');

                    /////////////HERE Q2*////////////
                    $(this).remove();
                    return false;
                });

                //////////////////////HERE Q1*//////////////////////
                $('body').click(function () {
                    $(".list_autobox_hotel p").hide().remove();
                    $('.auto_complete').val('');
                    $('.list_autobox_hotel').show().html('');
                    $('.list_autobox_hotel').css('display', 'none');
                });

            }
        },
        "error": function (x, y, z) {
            // callback to run if an error occurs
            alert("An error has occured:\n" + x + "\n" + y + "\n" + z);
        }
    });
});

PHP[insert to database]:

  $units = array();
  $name_units = $this->input->post('name_units');
  $price_units = $this->input->post('price_units');
  $checkbox_units = $this->input->post('checkbox_units');
  foreach ($name_units as $idx=>$name){
      $units[] = array(
    'name_units' => $name_units[$idx],
    'price_units' => $price_units[$idx],
    'checkbox_units' => $checkbox_units[$idx],
      );
  }
 $data = array('name' =>$this -> input -> post('name'),              
               'units' => json_encode($units)
 );

      $this -> db -> insert('hotel_submits', $data);

PHP[select code]:

$data = array();
foreach ($query_hotel_search->result() as $row)
{
   $units = json_decode($row->units);
   $data[] = array('name' => $row->name, 'units' =>$units );
}
echo json_encode($data);

DEMO: There are here the contents of the database and output code PHP and test code for you => CLICK HERE

UPDATE: json response:

Output values salam & salavat of php code: [this values select(selcet * from ...) by json_encode()]

salam:

[{“name”:”salam”,”units”:[{“name_units”:”salam”,”price_units”:”74,554″,”checkbox_units”:[“minibar”,”mobleman”]},{“name_units”:”mokhles”,”price_units”:”4,851,269″,”checkbox_units”:[“mobleman”,”tv”]},{“name_units”:”fadat”,”price_units”:”85,642″,”checkbox_units”:[“minibar”,”mobleman”,”tv”]}]}]

salavat:

[{“name”:”salavat”,”units”:[{“name_units”:”salam”,”price_units”:”5,452″,”checkbox_units”:null},{“name_units”:”khobe”,”price_units”:”5,452,545″,”checkbox_units”:[“minibar”,”mobleman”]}]}]

  • 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-25T11:23:15+00:00Added an answer on May 25, 2026 at 11:23 am

    my answer is totally based on assumption you are getting this json as response when i searched “salam”

    [
        {
            "name": "salam",
            "units": [
                {
                    "name_units": "salam",
                    "price_units": "74,554",
                    "checkbox_units": [
                        "minibar",
                        "mobleman"
                    ]
                },
                {
                    "name_units": "mokhles",
                    "price_units": "4,851,269",
                    "checkbox_units": [
                        "mobleman",
                        "tv"
                    ]
                },
                {
                    "name_units": "fadat",
                    "price_units": "85,642",
                    "checkbox_units": [
                        "minibar",
                        "mobleman",
                        "tv"
                    ]
                }
            ]
        }
    ]
    

    in the success callback iterate over the json as follow

    if (data == 0) {
    $('.list_autobox_hotel').show().html('<p><b>there is no</b></p>');
     }
     else
     {
      $.each(data[0].units, function (index, value) {
       $('<p id="' + data[0].units[index].name_units + '">' + data[0].units[index].name_units + '</p>').appendTo('.list_autobox_hotel');
      });
    

    here is a demo hopefully you will get the idea http://jsfiddle.net/BBSyy/

    EDIT

    see this fiddle http://jsfiddle.net/BBSyy/1/

    Another Edit

    see this fiddle with grep example http://jsfiddle.net/BBSyy/3/

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

Sidebar

Related Questions

can I convert a string to a html object? like: string s = '<div
How to convert Object to List. Can anybody tell me how to fix this
I receive TypeError: Can't convert 'float' object to str implicitly while using Gambler.pot +=
If I do the following I can convert from a time_struct object to a
How can I convert an array to a SimpleXML object in PHP?
How can I convert a string to a date time object in javascript by
Can you take a subclass object and somehow convert it to an object of
I want to convert 8 digit value to a DateTime object. How can I
You can convert a negative number to positive like this: int myInt = System.Math.Abs(-5);
If I defined an object in JS with: var j={name:binchen}; How can I convert

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.