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 1028355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:22:30+00:00 2026-05-16T12:22:30+00:00

I try to post some data via json objects to my asp.net mvc view,

  • 0

I try to post some data via json objects to my asp.net mvc view, here is the code

$("#submitButton").click(function () {
               var name = $("#name")[0].valueOf();
               var price = $("#price").valueOf();
               var url = $("#url").valueOf();

               var product = { Name: name, Price: price, Url: url };
                   $.post("/Home/NewProduct", product, function (json) { $('ul.items').append("<li><img src=" + url + "/></li>"); },"json");

           });

and now, the result is an error:

uncaught exception: [Exception… “Illegal operation on WrappedNative prototype object” nsresult: “0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)” location: “JS frame :: http://localhost:1804/Scripts/jquery-1.4.2.min.js :: f :: line 132″ data: no]

I try JQuery 1.4.1 and 1.4.2, If I try this code the error is the same

$.ajax({
     type: "POST",
     url: "/Home/NewProduct",
     dataType: "json",
     data: { Name: name, Price: price, Url: url },
     success: function () { $('ul.items').append("<li><img src=" + url + "/></li>"); }
               });

What I’m doing wrong? Please help!
Thanks!

  • 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-05-16T12:22:31+00:00Added an answer on May 16, 2026 at 12:22 pm

    To get the value of an input type element, use .val() instead of .valueOf(), like this:

    var name = $("#name").val(),
        price = $("#price").val(),
        url = $("#url").val();
    

    When you call .valueOf() on a jQuery object, it gets an array of DOM elements…and that doesn’t serialize well 🙂

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

Sidebar

Related Questions

I have passed some JSON to my page via a webservice. I used JSON.NET
i try to get some Data from a Access Database via OleDB in a
I'm using REXML to parse through some XML data sent via POST. The XML
i try to post data by ajax , it gives me name value bu
I'm having issues with my MVC3 vb.net application. When I try to post the
this is my first time to post a question here, I will try to
I'm trying to post some data to a function that will do a mysql
HttpRequestValidationException occurs when I try post when txtBulletin contains any HTML, like Hello<br />World
Every time I try to post to twitter in my rails app, the first
I could try to post and explain the exact query I'm trying to run,

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.