02-08-2010 03:49 PM
06-04-2010 12:55 PM - last edited on 06-04-2010 01:04 PM
I'm a noob. Anyone get this working? I'm getting same result. I get string value back from asmx service but when I assign the DIV the value it displays exactly what was sent back and not HTML formatted.
Service:
<WebMethod()> _
Public Function GetStuff() As String
Return "<div>This is some HTML <font size=10>HELP ME</font></div>"
End Function
Script:
function getstuff() {
...xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = function() {
...
var result = xmlHttp.responseXML;
document.getElementById("stuff").innerHTML = result;
}
The BB div tag displays the exact HTML string as returned from the service and not formatted as you would expect. I've tried pulling the node value but I get null. I've tried responseTEXT with the same result.
I'm missing something stupid I know it....
06-05-2010 10:13 PM
xmlHttp.onreadystatechange = function() {if (xmlHttp.readyState == 4){var contentElement = document.getElementById("MidDiv);//Temporary fix until RIM works out issue with responseX};... xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { var contentElement = document.getElementById("MidDiv"); //Temporary fix contentElement.innerHTML = processUpdate(xmlHttp.responseText); blackberry.focus.setFocus('Select1'); alert("station update received"); } }; ...
//Temporary method to parse responseText
function processUpdate(toProcess) {
toProcess = toProcess.replace(/</g,"<").replace(/>/g,">" );
var seperatedString = toProcess.split("~");
// save the individual data segments
var myAnswer = seperatedString[2];
saveNewDataUpdate(seperatedString);
return myAnswer;
}
Here is some of my code.
I'm passing the entire responseText to processUpdate().
Then I'm replacing the placeholders for the "<" and ">". In your web service, instead of < and > , you will need to use </g and >/g .
I'm then updating my div with the content from array position 2 while saving the rest of the array into a sqlite database.
06-07-2010 01:42 PM
Sorry, I mispoke in the above post.
On my web service side, I build the html string accordingly
i.e. string test = "<div> .... </div>";
Then, on the device side I use the methods from the post above. I'm guessing the most important part will be the .replace(....) line in my processUpdate function.