logo
down
shadow

Why i can not send parameter to controller with ajax?


Why i can not send parameter to controller with ajax?

Content Index :

Why i can not send parameter to controller with ajax?
Tag : asp.net-mvc , By : pad
Date : November 28 2020, 11:01 PM

Hope that helps You need to send the data in a format that matches the name of the parameter of the method your posting to. Change the ajax data option to
data: JSON.stringify({ value: '123' }),

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Send a string parameter to a controller (MVC3) from javascript (no ajax)


Tag : javascript , By : geo
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


Tag : jquery , By : n800s
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


Tag : jquery , By : mediafarm
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)?


Tag : javascript , By : Johannes
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');
Related Posts Related QUESTIONS :
  • Remote validation not working properly on IE?
  • Get local IP of a machine connected to a network in WEB API
  • Dropdown list in MVC view
  • Frequently refreshing web page during long-running process
  • How to get a list of sibling pages in Kentico
  • Ninject dependency injection: Read bindings from config?
  • ASP.NET MVC database connection using a form
  • IIS7.5 max-age issue(asp.net mvc output cache)
  • mvc linq controller view error
  • Creating Custom Authorization Attribute with MVC
  • How does the model binder figure out which user input to bind?
  • DecimalDynamicDisplayFormat constant expression error
  • Property injection upon initializing object manually
  • how to force partial view to render proper url
  • Identity can't connect to remote DB, keep connecting to local DB
  • How to use c# inside mvc razor pages
  • Reasons not to increase maxQueryStringLength?
  • asp.net mvc exclude an action from search engine crawling
  • Best Way to reuse code inside my Controller action method
  • BEM and asp.net mvc
  • RazorPDF save pdf file to server directory in MVC4
  • Controller Unit Testing with model validation
  • How to bind input field to editfor model MVC
  • WebGrid all buttons submits the form
  • How can I restrict access to a view only to two specific users each time in MVC?
  • Kendo UI Grid data bind to two table DB
  • How to modify CRUD operations with Entity Framework in .NET MVC application
  • ModelBinding Issue with a Struct
  • Web Api with & causing an error
  • dropdownlistfor selected value with viewdata
  • MVC 4 dropdownlist in edit form doesnt give the correct value after edit command from grid
  • Trying to move asp.net identity tables to my database
  • issue in adding elements into a list in mvc
  • IActionFilter class can only find physical attributes, not ones added in GlobalFilters config
  • ASP.NET MVC Bug with Model Binding: "Specified cast is not valid" when no data provided for dictionary
  • How to host ASP.NET MVC app on IIS10 win10
  • Get mongodb subDocument
  • SimpleMembershipProvider specify to use hash SHA512, something went wrong
  • How to bind a WebGrid in a PartialView, which is in JQueryUI ModalPopup
  • MVC Membership.UpdateUser(u); Specified method is not supported
  • How to reuse class in models without using validation for all of them
  • Null property in object recovered by EF
  • How to set routing to have some controller actions handled by angular
  • ads while debugging mvc website
  • Use partial views for custom MVC html controls
  • Does editing a Web.config file trigger an overlapping recycle or a start+stop of the application pool?
  • Refreshing my DataTable model and view every few seconds
  • Razor TextBoxFor name and value
  • Session and user authentication using ASP Identity
  • MVC: Should we have any if else OR other logical statement in View?
  • ASP.NET Core Capturing POST data
  • How can i delete multi selected records using checkbox in Kendo Grid?
  • 404.15 not found MVC4 RazorJS
  • Can't seem to get MvcSiteMapProvider to work with routes that have route values
  • ASP.NET Identity and Claims
  • Rejecting an otherwise successful ws-federation login in a CookieAuthenticationProvider()
  • Is it possible to run a java script in a partial view in MVC 5?
  • Passing selected value from the radio buttons to the controller in MVC
  • TFS:The "Microsoft.Reporting.RdlCompile" task could not be loaded from the assembly Microsoft.ReportViewer.Web
  • Uploaded Image not a Display in my Grid View
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com