I'm trying to retrieve specific data value by id from other page on my site by using query ajax.
by debugging on Chrome canary i have seen that I'm getting all the page data on dataAll
,and than its throwing me an error on line dataVal=$(dataAll).find('#counter').text();
also i don't want to use $("#div1").load("demo_test.txt");
method .
the error :
Uncaught TypeError: Cannot read property 'parentElement' of null
RTE.Canvas.checkCurrentFocus
I'm using it on Content Editor web part for implement my script
<html>
<head>
<script type="text/javascript" src="~/SiteAssets/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
var value;
var dataVal;
var dataAll;
$(document).ready
(function()
{
value = $('div[id="cl"]').length;
$("#cl").click
(function()
{
alert("HELLO WORLD! " + value);
}
);
$.ajax(
{url: '~/Forms/view1.aspx',
success: function(dataAll)
{
dataVal=$(dataAll).find('#counter').text();
$('#counte').html(dataVal);
alert('Done.');
// }
}
,
error: function(){
alert('error!');
}
}
);
}
);
</script>
</head>
<body>
<div id="counte"> <div>
<button id="cl">Click Me</button>
</body>
</html>
thank you very much