Send a string parameter to a controller (MVC3) from javascript (no ajax)
Date : March 29 2020, 07:55 AM
To fix the issue you can do You may need to set up a route in global.asax to handle the string parameter, i.e: RouteTable.Routes.MapRoute(
"ValueRoute",
"{controller}/{action}/{value}",
new
{
controller = "Yourcontroller",
action = "Youraction",
value = UrlParameter.Optional
}
);
|
Can i send parameter to php controller using javascript but without jquery or ajax?
Tag : php , By : Rb.Ridge
Date : March 29 2020, 07:55 AM
wish helps you well the question is enough explained can it be done. , You can just use jquery-less AJAX: var a = new XMLHttpRequest();
a.open("GET","myscript.php?var=foo&othervar=bar",true);
a.onreadystatechange = function() {
if( this.readyState == 4) {
if( this.status == 200) {
// data sent successfully
// response is in this.responseText
}
else alert("HTTP error "+this.status);
}
};
a.send();
|
Send string parameter to controller using AJAX call for jquery
Date : March 29 2020, 07:55 AM
To fix the issue you can do You need to define name for the data you sending data: {'status': status}: this.GetTransactionsInputToday = function () {
var status="complete"
var r = '';
$.ajax({
url: '/Management/function1',
contentType: "application/json; charset=utf-8",
data: {'status': status},
type: 'GET',
cache: false,
success: function (result) {
r = result;
}
});
return r;
};
|
how to send image data through ajax as a parameter to spring controller
Date : March 29 2020, 07:55 AM
Any of those help You don't send a parameter. You only send data. And the data you are sending is a String. If you want it to converted automatically to something else you need an appropriate converter. Anyway, what your are looking for is the @RequestBody annotation. public void SaveImage(@RequestBody String imgData)
|
How to properly get a parameter send using ajax in a Symfony controller (annotation)?
Date : March 29 2020, 07:55 AM
Hope that helps Since you are using a POST request, you can get the your POST parameter in your controller like this: $search = $request->request->get('data');
$search = $request->query->get('data');
|