If you're going to be using client-side script, I would recommend using the Javascript Client Object Model as it will handle making the web service call, creating the post XML, parsing the results, etc.
var surveyItems = null;
function getSurveyItems() {
var ctx = new SP.ClientContext.get_current();
var surveyList = ctx.get_web().get_lists().getByTitle('MySurvey');
var caml = new SP.CamlQuery();
surveyItems = surveyList.getItems(caml);
ctx.load(this.surveyItems);
ctx.executeQueryAsync(Function.createDelegate(this, itemsRetrieved),
Function.createDelegate(this, itemsNotRetrieved));
}
function itemsRetrieved() {
var enumerator = surveyItems.getEnumerator();
while (enumerator.moveNext()) {
var surveyItem = enumerator.get_current();
// internal name for one of the questions
// this will output the answers
alert(surveyItem.get_item('What_x0020_is_x0020_your_x0020_f'));
}
}
function itemsNotRetrieved() {
alert('Could not retrieve list');
}
You have to make sure the following controls are loaded some where on the page:
<SharePoint:ScriptLink ID="ScriptLink1" runat="server" Name="sp.js" Localizable="false" LoadAfterUI="true" />
<SharePoint:FormDigest ID="FormDigest1" runat="server" />
The first one links the Javascript library for the COM. The second one insert a security token in a hidden input on the page, which lets the site know you are authenticated. Otherwise, it may not let you retrieve data. These controls are usually already on the page but if something is not working, try adding these.