Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

jquery post only to server

Posted on 2014-10-13
3
Medium Priority
?
116 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:Seven price
[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 2000 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:Seven price
ID: 40377430
thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
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 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)

721 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