-2
$.ajax({
    url: "/Admin/GetUserByFirstName/" + $("#data").text(),
    method: "get",
    dataType: 'html',
    success: function(result) {
        $("#searchuserbutton").click(function() {
            $("#fetchdata").html(result);
        });
    }
});

I want to concatenate the Url of ajax call with a string that i want to search by putting in the ajax call in the action of controller

Sajjad
  • 3
  • 4

1 Answers1

0

It looks like you want to put $("#data").text() in the data parameter:

$.ajax({
    url: "/Admin/GetUserByFirstName/",
    method: "get",
    data: $("#data").text(),
    dataType: 'html',
    success: function(result) {
        $("#searchuserbutton").click(function() {
             $("#fetchdata").html(result);
        });
    }
});

It should create the URL string for you

Ricardo Reyna
  • 574
  • 6
  • 15