Hi, I have a JavaScript function code where I want to alert.
function msgalert(x,y)
{
tempstr = x.value
if(tempstr.length>y)
{
alert(c_AcknowledgementText);
x.value = tempstr.substring(0,y);
}
}
Now I have an xml with below format:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<key name="c_ContactUsHeading">Contact Us</key>
<key name="c_AcknowledgementText">Comments can not be more than 250 characters.</key>
</root>
I want the JavaScript code so that the message shown in above alert can be read from above xml key name "c_AcknowledgementText".
I am trying with the below code, but unable to solve the problem, can you please have a look
<script language="javascript" type="text/javascript">
function msgalert(x,y)
{
tempstr = x.value
if(tempstr.length>y)
{
$(document).ready(function(){
$.ajax({
type: "GET",
url: "../includes/ResourceData.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('key').each(function(){
var title = $(this).find('name').text();
);
});
}
});
});
}
}
</script>
some where I need to modify the above function so that I can use it to give alert value through XML.