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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:36:38+00:00 2026-06-09T04:36:38+00:00

hi everyone im just started learning ajax. im trying to get the return value

  • 0

hi everyone im just started learning ajax.

im trying to get the return value from php using ajax call and display to text fields.
here is my ajax code.

var getitem=$('#selectedItemId2').val();
        if (getitem==''){
        //do nothing
        }else{
            // verifying if item code is already been save and put to the text fields 
            $('#gettingitem').css('display','block');
            $('#gettingitem').html();

            $.ajax({
                    type: 'POST',
                    url:   'veritemcode.php',
                    datatype: 'text',
                    data:{'getitem':getitem
                    },
                    success:function(data){

                        window.setTimeout(function(){

                            $('#gettingitem').css('display','none');
                            $('#disp').css('display','block');
                            $('#disp').html(data);



                          });
                    }
            });}

and this is my veritemcode.php that i want to display on the text fields

 $getitem=$_REQUEST['getitem'];

        $verifyitem=mysql_query("select * from item_master where item_code='".$getitem."'") or die (mysql_error());
        $vernum=mysql_num_rows($verifyitem);
        if($vernum!=1){


        }else{
                while($dispresult=mysql_fetch_array($verifyitem)){
                             echo $dispresult['item_desc'];
                             echo $dispresult['sup_item_code'];
                             echo $dispresult['smalluom'];

                }

        }

all i want is to display the echo to this fields

<input type='text' id='itemdesc'/>

<input type='text' id='supitem'/>

<input type='text' id='smalluom'/>

Please help me with this problem…

  • 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-09T04:36:39+00:00Added an answer on June 9, 2026 at 4:36 am

    I would do the following…

    split the ajax data in php by a special character, for example a pipe:

                while($dispresult=mysql_fetch_array($verifyitem)){
                             echo $dispresult['item_desc'] . "|";
                             echo $dispresult['sup_item_code'] . "|";
                             echo $dispresult['smalluom'];
                }
    

    then in html/javascript right after success:function(data){ add the following:

                        var split_data=data.split("|");
                        $("#itemdesc").val(split_data[0]);
                        $("#supitem").val(split_data[1]);
                        $("#smalluom").val(split_data[2]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone. This is a piece of code from using sqlite in android tutorial: return
I have not used PackedArray before, but just started looking at using them from
I just started using SVN, and I set up a repository, because everyone were
everyone... I've just started to learn how to create process and thread using Windows
MOV is probably the first instruction everyone learns while learning ASM. Just now I
i just started using Flash builder 4 and i have a problem. As it
I've just started out learning C , and ( seemingly ) so far most
Just started playing around with, how is everyone linking up their component ids ?
We just started using git for our production code, and we are running into
I just recently started looking into WatiN and was following the example from http://www.codeproject.com/KB/aspnet/WatiN.aspx

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.