Solved

jquery post only to server

Posted on 2014-10-13
3
108 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 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:Seven price
ID: 40377430
thanks
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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…

626 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