Solved

jquery post only to server

Posted on 2014-10-13
3
100 Views
Last Modified: 2014-10-13
Yes like to change to post to the server only. I do  not need a response. this generates a server 500 error since this is part of a popup I am closing at the same time I am sending data. is this possible.

JSONstring = JSON.stringify(JSONObject);
  $('.cte').click(function () {
       $.ajax({
            contentType: "application/json; charset=utf-8",
            data: JSONstring,
            processData: false,
            dataType: "JSON",
            type: "Post",
            url: '/Manager.aspx/CloseBtn',
            async:false,
            success: fnSuccess,
            error: function(xhr, status, errorThrown) {
                 $('.showF').show();
                 $('.showF').html( ParBId + ' Error: ' + errorThrown.toString());
              CloseDialog();
           }
        })
        function fnSuccess(response) {
         $('.showF').show();
                 $('.showF').html( response.d.toString() );
                 CloseDialog();
        }
        })
        }
   });

Open in new window

0
Comment
Question by:sevensnake77
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 40377145
try to replace :
JSONstring = JSON.stringify(JSONObject);
by :
JSONstring = JSONObject;

and why not :
type: "POST",
0
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 500 total points
ID: 40377155
Sorry mate, I didn't get your problem.

If you want to just send a POST to the server and you don't care about the response just don't use the success event handler.

From your code I see you're actually handling the success event, doing something with the result and closing a popup.
If you're getting an HTTP 500 error this means that it's a server-side error, is has nothing to do with this code you posted here. Maybe you're passing unexpected parameters or doing something in the CloseBtn webmethod that is causing this error.

I would advise you to debut the server-side code.
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 40377430
thanks
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question