Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7962309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:18:13+00:00 2026-06-04T05:18:13+00:00

I have a JavaScript function which redirect to Asp.net MVC action method. [AcceptVerbs(HttpVerbs.Post)] public

  • 0

I have a JavaScript function which redirect to Asp.net MVC action method.

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult SupplierDetail(int SupplierID)
    {
        int test = SupplierID;
        return View();
    }

/// Java Script Code ...

$('#list .clsRowButtonClick').live('click', function () {
        var id = $(this).attr('RowID');
        var type = $(this).attr('ButtonType');
        alert("ID: " + id + " \nButtonType :" + type);

        var Supplier = {};
        Supplier.SupplierID = id;
        var jsonString = JSON.stringify(Supplier);

        $.ajax({
            type: "POST",
            url: "/Supplier/SupplierDetail/",
            dataType: "json",
            data: jsonString,
            contentType: "application/json; charset=utf-8",                
            success: function (response, textStatus, jqXHR) {
                alert("success");
            },
            error: function (jqXHR, textStatus, errorThrown) {
                //alert(jsonString);
                alert("jqXHR.responseText --> "+ jqXHR.responseText + "\njqXHR --> " + jqXHR + "\ntextStatus --> " + textStatus + " \nerrorThrown --> " + errorThrown);
            }
        });
    });

It worked as I had expected. It fire SupplierDetail Action Method by supplying corrected parameter value.

But what problem is it raise error after calling action method named SupplierDetail.

So I traced the code by using javascript alert function.

jqXHR.responseText --> <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>SupplierDetail</title>
<link href="/Content/themes/Redtheme/theme.css" rel="stylesheet" type="text/css" />
<link href="/Content/themes/Redtheme/style.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery-1.6.3.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-ui-1.8.11.js" type="text/javascript"></script>
<script src="/Scripts/modernizr-2.0.6-development-only.js" type="text/javascript">    </script>
<link href="/Scripts/jqgrid_utils/css/cupertino/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/jqgrid_utils/css/ui.jqgrid.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jqgrid_utils/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.base.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.celledit.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.common.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.custom.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.filter.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.formedit.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.grouping.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.import.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.inlinedit.js" type="text/javascript">    </script>  
<script src="/Scripts/jqgrid_utils/grid.jqueryui.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.loader.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.subgrid.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.tbltogrid.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/grid.treegrid.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/jqDnR.js" type="text/javascript"></script>  
<script src="/Scripts/jqgrid_utils/jqModal.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/jquery.fmatter.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/JsonXml.js" type="text/javascript"></script>
<script src="/Scripts/jqgrid_utils/jquery.jqGrid.min.js" type="text/javascript">    </script>
</head>
<body>
<div id="container">
<div id="header">
    <div>
        <h2>POS 2012</h2>
    </div>
    <div id="topmenu">
        <ul>
            <li class="current"><a href="./MemberRegistration.jsp">Suppliers</a></li>
            <li><a href="./RetailerRegistration.jsp">Products</a></li>
            <li><a href="./Index.jsp">SupplierOrder</a></li>
            <li><a href="#">Contact us</a></li>
        </ul>
    </div>
</div>
<div id="wrapper">
<h2>SupplierDetail</h2>
<script src="/Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript">    </script>
<form action="/Supplier/SupplierDetail/" method="post">    <fieldset>
    <legend>Supplier</legend>
    <div class="editor-label">
        <label for="SupplierName">SupplierName</label>
    </div>
    <div class="editor-field">
        <input class="text-box single-line" id="SupplierName" name="SupplierName" type="text" value="" />
        <span class="field-validation-valid" data-valmsg-for="SupplierName" data-valmsg-replace="true"></span>
    </div>
    <div class="editor-label">
        <label for="Address">Address</label>
    </div>
    <div class="editor-field">
        <input class="text-box single-line" id="Address" name="Address" type="text" value="" />
        <span class="field-validation-valid" data-valmsg-for="Address" data-valmsg-replace="true"></span>
    </div>
    <div class="editor-label">
        <label for="Phone">Phone</label>
    </div>
    <div class="editor-field">
        <input class="text-box single-line" id="Phone" name="Phone" type="text" value="" />
        <span class="field-validation-valid" data-valmsg-for="Phone" data-valmsg-replace="true"></span>
    </div>
    <p>
        <input type="submit" value="Create" />
    </p>
</fieldset>
</form>
<div>
<a href="/">Back to List</a>
</div>
</div>
<div id="footer">
    <div id="credits">
        Copy right &copy; ....
    </div>
    <br />
</div>
</div>
</body>
</html>
jqXHR --> [object Object]
textStatus --> parsererror 
errorThrown --> SyntaxError: JSON.parse: unexpected character

Every suggestion will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:18:14+00:00Added an answer on June 4, 2026 at 5:18 am

    It looks like you are expecting a HTML response from the server – so you will need to change the dataType option’s value to “html”, (or remove it altogether).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JavaScript function which is quite long and performs a number of
I have a javascript function which needs to do a numerical calculation. Some of
I have a javascript function for checking errors which I am calling on OnClicentClick
I would like a JavaScript function to have optional arguments which I set a
I have a javascript function which redirects user to a diff page. It goes
I have a javascript function which passes as a query string value another query
SO I have a php function for redirecting public function redirect($url, $permanent=false, $statusCode=303) {
I have a function which echoes javascript to navigate to a different page. While
in .gsp file i have javaScript function <script type=text/javascript> function getCurrentItemNumber(){ return document.getElementById('item_itemNumber').innerHTML.substr(6); }
I have a javascript function that calls a generic function to make an ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.