When trying to pass a parameter to the mehod I get
error: not found
I've been trying other url syntaxes (@url.action) but to no avail also.

script inside input/index view

    $(document).ready(function () {
          $("#btnSubmit").click(function () {
                var presc1 = $('#p1').val();

                    type: "POST",
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    url: "prescavi/abrir",
                    data: "{presc1}",

                    success: function (data) {
                    alert("Success: " + success.d);
                    //call on ajax call failure
                    error: function (xhr, textStatus, error) {
                    alert("Error: " + error);

method abrir inside prescaviController

        Function abrir(param As String) As ActionResult
            ViewData("Message") = "abriu! " & param & " ."

            Return View()
        End Function

also tried to other methods of the same controller.
( Public Class prescaviController ) with and without parameters - just to check if it triggered the next action

with "../prescavi/abrir" it gives me a different error, either with or without any parameters: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"

Edited by nosfa

2 Years
Discussion Span
Last Post by nosfa
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.