Problem loading scripts from Ajax Response

Posted by konathamrajesh on Stack Overflow See other posts from Stack Overflow or by konathamrajesh
Published on 2010-02-25T21:00:41Z Indexed on 2010/05/23 11:40 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

The problem is I am using get_info() to make a ajax call to Result.lasso and paste the response in div with id 'test'.I am unable to use the sendForm() function from the page where i am calling the get_info().

I have also tried using different versions of jQuery 1.1.1.3 is working fine.But i am facing the problem while using higher versions of jquery.

The error with higher versions is as follows

missing } in XML expression
[Break on this error] alert('hi');\n
test.lasso (line 3)
sendForm is not defined
[Break on this error] sendForm();  

get_info() function definition

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<SCRIPT>
function get_info()
{
    $.ajax({url: "Result.lasso", context: document.body, success: function(response){
    document.getElementById('test').innerHTML = response ;},dataType:"script"});
}
</SCRIPT>

The code in Result.lasso is as follows

[Content_Type: 'text/html; charset=UTF-8']
<script type="text/javascript">
    function sendForm()
    {   
        alert('hi');
    }
</script>   
[Date]
 form name= "abc" method = "get" action = "abcd.lasso">
    input type ="text" name = "element1"/>
    input type = "button" value="Click" onClick = "javascript: sendForm();"/>
</form>

Please help me out in resolving this problem

Thanks, Rajesh Konatham

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX