The value comes out from jsp. However, I don't know how to send the value as ajax data.
I tried to print the jsp value and change it, but it failed. What should I do?
What should I put in the data in ajax?
This is jsp.
The output of “out.println(name + ” : ” +obj.toString());” is “name : test_00”.
The output of “auth.getAttributes()” is “{name=test_00}”.
And I want it to be sent right away when onload Is this correct?
Please tell me the answer how to do this
<%
if (auth.isAuthenticated())
{
out.println("auth.getErrorMessage() :"+auth.getErrorMessage());
}
else
{
Map<String, Object> attr = auth.getAttributes();
if (attr.isEmpty())
{
out.println("Attribute is empty.");
}
else
{
Collection<String> keys = attr.keySet();
for (String name:keys)
{
Object obj = attr.get(name);
out.println(name + " : " + obj.toString());
out.println("<br>");
}
}
}
%>
<script>
window.onload = function() {
acs();
}
function acs(){
$.ajax({
//url: "/login",
type : "POST",
data : '???????',> I don't konw
dataType: 'json',
success: function (data) {
console.log(data);
}
},
});
}
</script>