Pass null value using ajax

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
cohq82
Forum Commoner
Posts: 43
Joined: Mon Apr 21, 2008 8:38 pm

Pass null value using ajax

Post by cohq82 »

Hi,

I wonder if there is a way to pass a null value through ajax. For example in the code below, sometime the toMessageId is not used but the server side requires it. Is there a way to pass something like this "toMessageId: null"? I tried and that didn't work. The way I do it now is to pass "0" value instead but that is not right. If I don't pass anything, it pops error. Please let me know. Thanks

Code: Select all

 
      $.ajax(
        {
          type: "POST",
          async: false,
          url: "/Status/AddNewMessage",
          data: {
            message: msg,
            toMessageId: 0,
            sendBy: 'sendername'
          },
          success: function(html) {
            alert("good to go");
          },
          error: function(error) {
            alert(error);
          }
        });
    }
 
Last edited by Benjamin on Mon May 11, 2009 12:04 am, edited 1 time in total.
Reason: Changed code type from text to javascript.
cohq82
Forum Commoner
Posts: 43
Joined: Mon Apr 21, 2008 8:38 pm

Re: Pass null value using ajax

Post by cohq82 »

never mind.. it was the server issue.
Post Reply