Solved

jquery post only to server

Posted on 2014-10-13
3
96 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn how to dynamically set the form action using jQuery.
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)

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now