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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:57:03+00:00 2026-06-08T12:57:03+00:00

I am getting my data from a web service using ajax call. i am

  • 0

I am getting my data from a web service using ajax call. i am saving it in a variable, the problem i am facing is that i need to display this data that i am getting into a select menu..
i am not able to crack it up.
my html code.

<div data-role="page" id="requestPage">
<div data-role="fieldcontain">
<select id="select-choice-3" name="pid you need">
<option value="select-value" selected="selected">-- Select PID --</option>
// here i want my data to be
</select>
</div>
</div>

JS code

function content_Load(){
var soapMessage='<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><GetProjectByPeopleId xmlns="http://there.org/"><tmsUserId>' + TmsUserId +'</tmsUserId></GetProjectByPeopleId></soap:Body></soap:Envelope>'

$.ajax({
       url: "http://22.232.32.14/therewebservice/thereeatmswebservice.asmx?op=GetProjectByPeopleId",
       type: "POST",
       dataType: "xml",
       SOAPAction: "http://there.org/GetProjectByPeopleId",
       data: soapMessage,
       complete: endSaveProduct,
       contentType: "text/xml; charset=\"utf-8\""
       });
return false;
}
function endSaveProduct(xmlHttpRequest,status){

$(xmlHttpRequest.responseXML)
.find('Table')
.each(function()
      {
      var ProjectName =$(this).find('ProjectName').text();
// i am able to get ProjectName as my data, now i want it to get into the select menu for which i have written the code bellow but that's not working.
      var optionlist='';
      optionlist += '<option>' + ProjectName + '</option>';
      $("#select-choice-3").html(optionlist).selectmenu('refresh', true);
      window.location.href="#requestPage";

      });
}
  • 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-08T12:57:05+00:00Added an answer on June 8, 2026 at 12:57 pm

    It looks to me that in the endSaveProduct function, when you are iterating over each ‘Table’, you:

    1. blank/clear the variable optionlist (optionlist = ”;),
    2. add ProjectName to the variable optionlist (which is correct, but since you blank it each time, this has no effect)
    3. overwrite the select with the ProjectName found,
    4. navigate to the #requestPage.

    If I’m correct, this is leaving you with only the last ‘ProjectName’ found after the loop has finished, effectively giving you a select with just one option. Try placing the optionlist variable, the actual populating of the option list and the redirection outside the each():

    function endSaveProduct(xmlHttpRequest,status){
        var optionlist=''; //moved variable declaration here
        $(xmlHttpRequest.responseXML)
            .find('Table')
            .each(function()
            {
                optionlist += '<option>' + $(this).find('ProjectName').text() + '</option>'; //shortened it
            });
        //moved populating the optionlist here
        $("#select-choice-3").html(optionlist).selectmenu('refresh', true);
        window.location.href="#requestPage";
    }
    

    I haven’t tested this, but I think this is the problem.

    Also, you are overwriting your default selected ‘–Select PID–‘ option. To fix that you can also rewrite the optionlist definition as:

    var optionlist = '<option value="select-value" selected="selected">-- Select PID --</option>';
    

    Or, as suggested by joerajeev, use .append() instead of html().

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

Sidebar

Related Questions

I'm getting some data from the web service and saving it in the core
I am getting data nightly from a web service that stores their fields in
I am trying to display JSON data that I retrieve from an ajax call
I'm using jQuery's $.ajax method to fetch data from a JSONP-compatible web service and
I am getting response from web service in xml format and data are inside
I am using iPhone to get data from my web service. Because I wan't
I'm trying to grab some JSON data from a web service using JSON.Net. The
I have to make a web-service in Zend Framework for getting data from java
The problem is getting data in my dataGridView from my webservice. When i invoke
I am getting data from iphone using php but when i insert post data

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.