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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:59:59+00:00 2026-06-14T14:59:59+00:00

i am trying to run a send message from jquery ajax but getting following

  • 0

i am trying to run a send message from jquery ajax but getting following error

{"Message":"Invalid JSON primitive: .","StackTrace":"   at 
System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()   at 
System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth) at  System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeDictionary(Int32 depth) at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n   at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n   at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

my jquery code :

function sendmessage(){
var project_id = $("#DropDownList1 option:selected").val();
var formstatus = $("#DropDownList4 option:selected").val();
var formcode = $('#FormCText').val();
var uniquecode = getunique();
var to = $('.showto').attr("id");
var cc = getcc();

if ($('#urgent').prop("checked"==true))
{
var d = new Date();
var duedate = d.getFullYear() + "/" + (d.getMonth()+1) + "/" + d.getDate();
var urg = 1;
}
else
{
var duedate=$('#datepicker').val();
var urg = 0;
}

if($('#readreceipt').prop("checked"==true))
{
var receipt = 1;
}
else{
var receipt = 0;
}
var fsub = $('#fsub').val();
var nicE = new nicEditors.findEditor('message');
var message = nicE.getContent();
alert("'project_id':'"+ project_id+"','formstatus':'"+ formstatus+"','formcode':'"+formcode+"','uniquecode':'"+ uniquecode+"','tor':'"+to+"','cc':'"+cc+"','duedate':'"+duedate+"','urg':'"+urg+"','receipt':'"+receipt+"','sub':'"+fsub+"','message':,'"+message+"'");

 $(document).timer = setTimeout(function () {
 alert("now sending values");
 $.ajax({
  type: "POST",
  url: "consoservice.asmx/sendmessage",
  data: "{'project_id':'" + project_id+ "','formstatus':'" + formstatus+ "','formcode':'" + formcode + "','uniquecode':'ghfg','tor':'"+to+"','cc':'"+cc+"','duedate':'"+duedate+"','urg':'"+urg+"','receipt':'"+receipt+"','fsub':'"+fsub+"','message':,'"+message+"'}",
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  success: function(msg) {
  if (msg.d == "sent")
  {
 alert('message sent successfully for approval');
  }
  else{
  alert(msg.d);
  }
    // Do something interesting here.
  }
}); }, 100);
}

my service function code

  <System.Web.Services.WebMethod()> _
    <System.Web.Script.Services.ScriptMethod()> _
  Public Function sendmessage(ByVal project_id As String, ByVal formstatus As String, ByVal formcode As String, ByVal uniquecode As String, ByVal tor As String, ByVal cc As String, ByVal duedate As String, ByVal urg As String, ByVal receipt As String, ByVal fsub As String, ByVal message As String) As String

        MsgBox("reached")
        Dim ip As String = System.Web.HttpContext.Current.Request.UserHostAddress
        Dim usern As String = CookieUtil.GetEncryptedCookieValue("user_id")
        Dim returnvalue As String
        Dim ari As New moduleclass
        Dim i As Integer
        Try
            i = ari.InsertAp_module_message(usern, tor, formcode, cc, formstatus, duedate, receipt, urg, fsub, message, -1, uniquecode, 0, 0, DateTime.Now, ip, 0)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        If i > 0 Then
            returnvalue = "sent"
        Else
            returnvalue = "not sent"
        End If

        Return returnvalue
    End Function
  • 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-14T15:00:01+00:00Added an answer on June 14, 2026 at 3:00 pm

    The Exception thrown by system occurs only when the data you are sending is not in correct format, so double check the data before sending.

    i think data which you are sending should be like this :-

    Senddata={"project_id": project_id,"formstatus": formstatus,........};
    

    and in ajax call :-

     $.ajax({
      type: "POST",
      url: "consoservice.asmx/sendmessage",
      data:  JSON.stringify(Senddata),
    ............
    ..............
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run the following code but unfortunately facing Error problems package jskypeexample;
I'm trying to run a project which a friend of mine send me, but
When trying to run a junit test I get the following error - java.lang.ClassCastException:
I am trying to send a message to my main activity from an Async
I'm trying to get php mailer to work. I'm getting an error but couldn't
I'm trying to run Send-MailMessage directly from a command window. C:\>powershell Send-MailMessage -from 'test@test.com'
I am trying run a program from a qmake .pro file which modifies the
Trying to run the following command in php to run powershell command... the following
Trying to run my program in FreeBSD OS, I have the following results: $
Trying to run Jison unit tests, but the command fails. How do I fix

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.