Reputation: 8605
I am new to asp.net and frontend technologies in general. I have the following code:
<ul>
@foreach (var item in Model)
{
<li>
<img src="@item" alt="file here" width="100" height="100" />
<a id="@item" href="#" onclick="deleteFile('@item');">Delete</a>
</li>
}
</ul>
<script>
function deleteFile(item) {
var url = "/Home/DeleteFile";
$.post(url, { Name: item }, function (data) {
window.location.href = "/Home/Upload";
});
}
</script>
I know we can recognize the language in which the script is written by the type tag. E.g.
<script type="text/javascript"...
But without this type specified, how can I recognize the language of the script? Further in the script, what is the argument "function(data)" in the post statement doing and where is the data argument for that function coming from?
Thanks!
Upvotes: 0
Views: 210
Reputation: 943097
The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is "text/javascript".
Upvotes: 1