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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:30:06+00:00 2026-06-02T08:30:06+00:00

I am trying to pass these variables from 3 hidden fields to the data

  • 0

I am trying to pass these variables from 3 hidden fields to the data of the the ajax.

I am getting the correct variables. I verified via console.log. I tried to parse json but it didnt for me.

The error i am getting uncaught exception: [Exception… “Could not convert JavaScript argument” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: http://code.jquery.com/jquery-latest.js :: :: line 7740″ data: no]
Line 2

I am trying to pass these variables using the ajax request to my controller. The other variables in the datastring I have no issues at all. When a user clicks on a star rating the values are posted and inserted to a db.

Here are the variables:

       var TweetUserId =  $(this).parents().prevAll('input[type=hidden:first]') ;
          var TweetScreenName =  $(this).parents().prevAll('input[type=hidden:second]') ;
          var TweetPostText = $(this).parents().prevAll('input[type=hidden:third]') ;
 // making it an object didnt work
         //  TweetUserId = new Object; TweetUserId = (TweetUserId);
          // TweetScreenName = new Object; TweetScreenName = (TweetScreenName);
         //  TweetPostText = new Object; TweetPostText = (TweetPostText);

Here is the request

          $.ajax({
              url: '/Home/GetRating', //your server side script
              dataType: "json",
              data: { id: ratingid, value: value, TweetUserId: TweetUserId, TweetScreenName: TweetScreenName, TweetPostText: TweetPostText, tweetday: dateoftweet, tweettime: timeoftweet }, //our data
              type: 'POST',
              success: function (data) {
                  //$('#ratemsg').html(data);
                  msg.html(" The TweetId is " + ratingid + " the vote value is " + value + " " + dateoftweet + "  " + timeoftweet  );
                  //       console.log(hiddenValue);
              },
              error: function (jxhr, msg, err) {
                  //  $('#response').append('<li style="color:red">' + msg + '</li>');
                  msg.html(data);
              }
          });
      });

  });
  • 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-02T08:30:07+00:00Added an answer on June 2, 2026 at 8:30 am
    1. your are using selectors the wrong way and some are invalid :first :second :third
      (they should go outside the [type=hidden] and there are no :second :third .. use the :eq() selector instead
    2. You are passing elements instead of their value to the ajax request..

    Use this when populating the variables..

     var TweetUserId =  $(this).parents().prevAll('input[type="hidden"]:eq(0)').val();
     var TweetScreenName =  $(this).parents().prevAll('input[type="hidden"]:eq(1)').val();
     var TweetPostText = $(this).parents().prevAll('input[type="hidden"]:eq(2)').val();
    

    As a general pattern, it is better to cache a jQuery object when you intend to use it multiple times, instead of re-selecting it ..

    so you could improve your code with

     var hiddenElements = $(this).parents().prevAll('input[type="hidden"]'),
         TweetUserId =  hiddenElements.eq(0).val(),
         TweetScreenName =  hiddenElements.eq(1).val(),
         TweetPostText = hiddenElements.eq(2).val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to pass some variables from the URL to the PHP script. Now
Ok so I am trying to pass some string variables from a classic ASP
I'm trying to pass a java.util.Stack object from an Activity to another in an
I am trying to pass values of textbox with same name from JSP to
I'm trying to pass an array through jquery ajax call. However, I need to
I'm trying to pass local variables to an inline function in javascript and have
I'm trying to pass a variable from one include file to another. This is
I am trying to post multiple variables from the already dynamically create-able username id's
I am trying to pass multiple variables in a URL in PHP to GET
Possible Duplicate: Passing JavaScript Array To PHP Through JQuery $.ajax I'm trying to pass

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.