Valid response with next action to be followed by the JS
541250
def json_to_response(self, action=None, json_status=None, success_url=None,
                         json_data=None, **response_kwargs):
        
        data = {
            "status": self.get_status(json_status),
            "action": self.get_action(action),
            "extra_data": self.get_json_data(json_data or {})
        }

        if self.action == AjaxResponseAction.REDIRECT:
            data["action_url"] = success_url or self.get_success_url()
        return JsonResponse(data, **response_kwargs)
853433
function next() {
		
		var data = new Object();
		// Submit content of all forms -- except those with class 'ignore-form' -- before going to next page.
		$('#container form:not(.ignore-form)').each(function(index) {
			//console.log("Form no. "+index + " with the ID #" + $(this).attr('id') );
			//console.log($( this ).serializeArray() );
			data[$(this).attr('id')] = $( this ).serializeArray(); // Add each form's data to the data object.
		});
		
		if(isEmpty(data)) 
			cloak.message('next');
		else
			cloak.message('next', data);
	}
924111
function( url, els, isHijax ) {
			$.get( url, function( data, status, xhr ) {
				els.trigger( "ajaxIncludeResponse", [ data, xhr ] );
			});
		}
1302084
function guessnumber(request, response) {
  if (request.body.result) {

    dashbot.logIncoming(request.body)

    var action = request.body.result.action;

    // Handle a request where the action is "generate_answer"
    if (action == "generate_answer") {
      var answer = getRandomNumber(1,100);
      let msg = {
        speech: "I’m thinking of a number from 0 to 100. What’s your first guess?",
        data: { google: { expect_user_response: true } },
        contextOut: [
          {
            name:"game",
            lifespan:100,
            parameters:{
              answer:answer
            }
          }
        ]
      }
      dashbot.logOutgoing(request.body, msg)
      response.send(msg);

    // Handle a request where the action is "check_guess"
    } else if (action == "check_guess") {
      var answer = parseInt(request.body.result.contexts[0].parameters.answer);
      var guess = parseInt(request.body.result.parameters.guess);
      var tts = "Congratulations, that’s it! I was thinking of " + answer;
      var closeMic = false;
      if (answer > guess) tts = "It's higher than " + guess + ". What's your next guess?";
      else if (answer < guess) tts = "It's lower than " + guess + ". Next guess?";
      else closeMic = true;

      let msg = {
        speech: tts,
        data: { google: { expect_user_response: !closeMic }}
      }
      dashbot.logOutgoing(request.body, msg)
      response.send(msg);
    }
    return;
  }
}
913721
def _handle_response(self, request: Request, response: Response):
        ''''''
        self._item_session.update_record_value(status_code=response.reply.code)
        is_listing = isinstance(response, ListingResponse)

        if is_listing and not self._processor.fetch_params.remove_listing or \
                not is_listing:
            filename = self._file_writer_session.save_document(response)
            action = self._result_rule.handle_document(self._item_session, filename)
        else:
            self._file_writer_session.discard_document(response)
            action = self._result_rule.handle_no_document(self._item_session)

        if isinstance(response, ListingResponse):
            self._add_listing_links(response)

        return action
1303500
function handler(req, res, next) {
    next = next || send

    if (pending) return pending.once('ready', function(err) {
      if (err) return next(err)
      return handler(req, res, next)
    })

    if (prevError) return next(prevError)

    res.setHeader('content-type', 'text/css')
    return next(null, buffer)

    function send(err, body) {
      if (err) return res.emit(err)
      res.end(body)
    }
  }
1009284
function (next) {
                request(url, function (err, res, body) {
                    if (err) {
                        return next(err);
                    }
                    next(null, body);
                });
            }
848640
def handle_intermediate_response(self, item_session: ItemSession) -> Actions:
        '''
        '''
        self._waiter.reset()

        action = self.handle_response(item_session)

        return action
116956
function validateAction (action, interactable) {
        if (!isObject(action)) { return null; }

        var actionName = action.name,
            options = interactable.options;

        if ((  (actionName  === 'resize'   && options.resize.enabled )
            || (actionName      === 'drag'     && options.drag.enabled  )
            || (actionName      === 'gesture'  && options.gesture.enabled))
            && actionIsEnabled[actionName]) {

            if (actionName === 'resize' || actionName === 'resizeyx') {
                actionName = 'resizexy';
            }

            return action;
        }
        return null;
    }
899830
function handleResponse(err, response, body) {
      if (this.debug) console.error('>>>handling response...');
      if (err) {
        if (onDone) onDone(err)
        else console.error('>>>upload to github failed: ', err);
        return;
      }

      if (stylesheet || title) {
        if (titleText == null) titleText = fileName;
        this.cat('<!DOCTYPE html>\n' +
                 '<html>\n' +
                 '<head>\n' +
                 '  <title>' + titleText + '</title>\n' +
                 '  <link rel="stylesheet" href="' + stylesheet + '">\n' +
                 '</head>\n' +
                 '<body>\n' );
      }

      this.cat(body);
      this.cat('\n');

      if (stylesheet || title) {
        this.cat( '</body>\n</html>\n' );
      }

      if (this.debug) console.error('>>>finished getting code');
      this.done = true;
      if (onDone) onDone();
    }
310511
def get_next_action(self, request, application, roles):
        

        # Check for serious errors in submission.
        # Should only happen in rare circumstances.
        errors = application.check_valid()
        if len(errors) > 0:
            for error in errors:
                messages.error(request, error)
            return 'error'

        # mark as submitted
        application.submit()

        return 'success'
322060
function controllerWrap(ctx, ctrl, hooks, next) {
  let result
  const preHooks = []
  hooks.pre.map(pre => {
    preHooks.push(() => pre(ctx))
  })

  return sequenceAndReturnOne(preHooks)
    .then(() => {
      return ctrl(ctx)
    })
    .then(data => {
      if (!data && ctx.body && ctx.body.data) {
        data = ctx.body.data
      }
      result = data
      const postHooks = []
      hooks.post.map(post => {
        // Use pre action's result for next action's data
        postHooks.push(preResult => post(ctx, preResult || result))
      })
      return sequenceAndReturnOne(postHooks)
    })
    .then(ret => {
      if (!ctx.body) {
        ctx.body = {
          code: 0,
          data: ret || result
        }
      }
      next && next()
    })
    .catch(err => {
      // throw errors to app error handler
      throw err
    })
}
1268007
function (err, data) {
      debug(' => service response:', err, data);
      if (err) return next(err.cause || err);

      res.data = data;

      if (!data) {
        debug(`No content returned for '${req.url}'`);
        res.status(statusCodes.noContent);
      } else if (method === 'post') {
        res.status(statusCodes.created);
      }

      return next();
    }
1325410
def check(func):
    
    def iCheck(request, *args, **kwargs):
        if not request.method == "POST":
            return HttpResponseBadRequest("Must be POST request.")
        follow = func(request, *args, **kwargs)
        if request.is_ajax():
            return HttpResponse('ok')
        try:
            if 'next' in request.GET:
                return HttpResponseRedirect(request.GET.get('next'))
            if 'next' in request.POST:
                return HttpResponseRedirect(request.POST.get('next'))
            return HttpResponseRedirect(follow.target.get_absolute_url())
        except (AttributeError, TypeError):
            if 'HTTP_REFERER' in request.META:
                return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
            if follow:
                return HttpResponseServerError('"%s" object of type ``%s`` has no method ``get_absolute_url()``.' % (
                    unicode(follow.target), follow.target.__class__))
            return HttpResponseServerError('No follow object and `next` parameter found.')
    return iCheck
414000
private function responseIntendedAction()
    {
        $lead = $this->conversation->get('lead');

        $waiting = $lead->_wait;

        // We set previous_waiting to back to support $bot->keep() method
        $this->conversation->set('previous_intended_action', $waiting);

        if (!empty($waiting)) {
            $lead->update([
                '_wait' => false
            ]);

            // Get Nodes for intended actions.
            if (is_numeric($waiting)) {
                $nodes = Node::find($waiting);

                if (!empty($nodes)) {
                    $nodes = [$nodes];
                }
            } else {
                $nodes = Node::findByTypeAndPattern('intended', $waiting);
            }

            $this->response($nodes);

            return true;
        }

        return false;
    }
839515
function(request, response, next){
		if (!utils.Misc.isNullOrUndefined(request.user) || request.originalUrl == '/error' || request.originalUrl.indexOf('/error?') == 0) {
			next();
		}
		else {
			var success = encodeURIComponent(request.protocol + '://' + request.get('host') + request.originalUrl);
			response.redirect('/login?success=' + success + '&no_query=true'); //we don't want it to add any query string
		}
	}
746029
function () {
            var self = this;
            var originalListAction = self.options.actions.listAction;
            self.options.actions.listAction = function (postData, jtParams) {
                return $.Deferred(function ($dfd) {

                    var input = $.extend({}, postData, {
                        skipCount: jtParams.jtStartIndex,
                        maxResultCount: jtParams.jtPageSize,
                        sorting: jtParams.jtSorting
                    });

                    originalListAction.method(input)
                        .done(function (result) {
                            $dfd.resolve({
                                "Result": "OK",
                                "Records": result.items || result[originalListAction.recordsField],
                                "TotalRecordCount": result.totalCount,
                                originalResult: result
                            });
                        })
                        .fail(function (error) {
                            self._handlerForFailOnAbpRequest($dfd, error);
                        });
                });
            };
        }