I have javascript code which returns a partial view.
var url1="";
$.get(url1, { 'id': Gid }, function (result) {
$("#abcd").html(result);
});
View returning is
<div id="goalReport">
</div>
<script type="text/javascript">
function LoadReport() {
}
</script>
i want to call the load report function on success of the get function i wrote.
How can i call the load report function instead of appending it in a div abcd
i tried like
result.LoadReport
but it is not working
All the things you define in javascript are in the same context. It’s not like C# or some other languages although you have the scope definition and even you can have namespaces. So you can simply change the code to this:
However there is another way that you can find the script contents by some RegEx or string functions and call the
"eval"function and initialize it without appending the html code to the document. I myself don’t recommend this way because it’s a buggy idea and it may cause you some silly exceptions.Hope it helps
Cheers