Ajax/javascript problem
-
I was on a session by Stephen Walther where he introdused client side ajax by a web service, the example was pritty simple:
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<td>
<asp:Button
id="btnShowDetails"
runat="server"
Text="test"
/>
</td>
</tr> </thead>
<tbody id="myTbody">
</tbody>
</table></div>
<script type="text/javascript">
function showText() {
AjaxWebService.MyWebService.Product.getText(showTextComplete);
}function showTextComplete(result) { $("myTbody").html(result); }
The web service return a simple string like "<table><tr><td>This is a test</td></tr></table>". The problem is in the function showTextComplete, I always get "Microsoft JScript runtime error: Object expected", it's the $("myTbody") that's wrong. When Walther showed it, it worked fine. So what em I doing wrong? Thanks Thomas
-
I was on a session by Stephen Walther where he introdused client side ajax by a web service, the example was pritty simple:
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<td>
<asp:Button
id="btnShowDetails"
runat="server"
Text="test"
/>
</td>
</tr> </thead>
<tbody id="myTbody">
</tbody>
</table></div>
<script type="text/javascript">
function showText() {
AjaxWebService.MyWebService.Product.getText(showTextComplete);
}function showTextComplete(result) { $("myTbody").html(result); }
The web service return a simple string like "<table><tr><td>This is a test</td></tr></table>". The problem is in the function showTextComplete, I always get "Microsoft JScript runtime error: Object expected", it's the $("myTbody") that's wrong. When Walther showed it, it worked fine. So what em I doing wrong? Thanks Thomas
thomasa wrote:
function showTextComplete(result) { $("myTbody").html(result); }
try var myTbody = $get("myTbody"); myTbody.html(result); or myTbody.html = result;
I didn't get any requirements for the signature
-
thomasa wrote:
function showTextComplete(result) { $("myTbody").html(result); }
try var myTbody = $get("myTbody"); myTbody.html(result); or myTbody.html = result;
I didn't get any requirements for the signature
var myTbody = $get("myTbody");
myTbody.html(result);gives me the objekt, thus the objekt does't support the method .html(..) (I can acully drop the "var myTbody = $get("myTbody");", since it findes it without it.) I thought maby I could use
myTbody.innerHTML = result;
But this gives me a "htmlfile: Unknown runtime error" exeption :(
-
var myTbody = $get("myTbody");
myTbody.html(result);gives me the objekt, thus the objekt does't support the method .html(..) (I can acully drop the "var myTbody = $get("myTbody");", since it findes it without it.) I thought maby I could use
myTbody.innerHTML = result;
But this gives me a "htmlfile: Unknown runtime error" exeption :(
Are you using VS2008? Can you set a break point to see the contents of result?
I didn't get any requirements for the signature
-
Are you using VS2008? Can you set a break point to see the contents of result?
I didn't get any requirements for the signature
-
Well then create a string variable and set it to the result. If you have your html object such as a div tag. And a string that is your innerHTML or innerText there is no reason why that shouldn't work.
I didn't get any requirements for the signature