Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:10:18+00:00 2026-06-11T23:10:18+00:00

I have this chunk of code: $.ajax({ type: POST, async: true, url: Notes/ViewAttachments.aspx/CompressFiles, data:

  • 0

I have this chunk of code:

$.ajax({
  type: "POST",
  async: true,
  url: "Notes/ViewAttachments.aspx/CompressFiles",
  data: "{ 'hidBinaryFileIDs': '" + csList + "', 'userID' : '" + userID + "'}",
  contentType: "application/json; charset=utf-8",
  dataType: "json",
  success: function (data) {
    $.Zebra_Dialog(data.d, {
      'type': 'information',
      'title': 'Confirmation',
      'buttons': [{
        caption: 'Ok',
        callback: function () {

        }
      }]
    });
  },
  error: function (xhr, ajaxOptions, thrownError) {
    $.Zebra_Dialog('Error : ' + xhr.status + ' - ' + xhr.statusText + ' : ' + thrownError, {
      'type': 'error',
      'title': 'Confirmation',
      'buttons': [{
        caption: 'Ok',
        callback: function () {}
      }]
    });
  }
});

When the ajax return success it displays the dialog box for a whole 2 seconds or so (not long enough for a user to read the message that it contains) then closes it. Using chrome’s debugger, I’ve determined that it runs out of scope without waiting for a confirmation on the dialog box inside the success function. Does anyone know how I would go about halting the code until the user clicks ok?

Here is the full chunk of code for that ajax call..

 var leZDB = null;
    function zipSelectedAttachments() {

        var ids = getSelectedTaskIDs();
        if (ids.length > 0) {
            leZDB = $.Zebra_Dialog('Do you want to zip the attachment(s)?', {
                'type': 'question',
                'title': 'Confirmation',
                'buttons': ['Yes', 'No'],
                'onClose':function (caption) {
                    if(caption = 'Yes') {
                        LinkAndPass(ids);
                    }
                }
            });
        } else {
            $.Zebra_Dialog('No attachments are selected.', {
                'type': 'error',
                'title': 'Error',
                'buttons': [
                    { caption: 'Ok', callback: function () { } }

                ]
            });
        }
    }

    function LinkAndPass(ids) {
        leZDB.close();
        if (true)
        {
            SendIDSForZipping(ids);
        }
    }

    function SendIDSForZipping(ids) {
        var csList = '';
        var userID = $('#hiduserID').val();

        for (var i = 0; i < ids.length; ++i) {
            csList += ids[i] + ',';
        }
        var $this = $(this);
        $this.die('click');

        $.ajax({
            type: "POST",
            //async: true,
            url: "Notes/ViewAttachments.aspx/CompressFiles",
            data: "{ 'hidBinaryFileIDs': '" + csList + "', 'userID' : '" + userID+ "'}",
            contentType: "application/json; charset=utf-8",
            context:this,
            dataType: "json",
            success: function (data) {
                var hasClickedOK = false;
                var hasDisplayed = false;
                    if (!hasDisplayed) {
                        hasDisplayed = true;
                        $.Zebra_Dialog(data.d, {
                            'type': 'information',
                            'title': 'Confirmation',
                            'buttons': [
                                {
                                    caption: 'Ok',
                                    callback: function () {
                                        hasClickedOK = true;
                                    }
                                }
                            ]
                        });
                    }
            },
            error: function (xhr, ajaxOptions, thrownError) {
                $.Zebra_Dialog('Error : ' + xhr.status + ' - ' + xhr.statusText + ' : ' + thrownError, {
                    'type': 'error',
                    'title': 'Confirmation',
                    'buttons': [
                        {
                            caption: 'Ok',
                            callback: function () {
                            }
                        }
                    ]
                });
            }
        });
    }

The getSelectedIDs() returns an array of numbers.

The Code behind returns a string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:10:20+00:00Added an answer on June 11, 2026 at 11:10 pm

    The problem consisted of the web method being called from the code behind. A faulty piece of logic caused it to refresh the page, instantly closing the box.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this chunk of code in my coffeescript: $('.asdasd').ready -> $.ajax '/splunk/100000000', type:
After doing so: $.ajax({ type: POST, url: $(#form).attr(action), data: value= + value + &sel=
If I have a chunk of code like this: .hover( function () { hoverState($(#navbar
I currently have this chunk of model code: class Book(models.Model): title = models.CharField(max_length=100) num_pages
I have this chunk of code which I found and implemented according to http://www.activexperts.com/activmonitor/windowsmanagement/scripts/networking/windowsfirewall/
I have this chunk of code which adds up all the players hurt on
Ok so i have this chunk of code <p id=number_of_stations class=text left><?php $_GET['count'] !=
I have this chunk of code. It works, but I'm sure there is a
I have this chunk of code: noObjs = 0 Dim oName As String Dim
I have this chunk of code, one sample is $dispatch='TC_12' : foreach($this->dispatch as $dispatch){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.