Solved

jquery post only to server

Posted on 2014-10-13
3
103 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reactjs with .NET 3 126
email validation 9 64
jquery change div image on page reload using Jquery 9 58
How does this modal work? 3 33
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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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…

734 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