diff --git a/module/ai/control.php b/module/ai/control.php index ef1752d107..90a2d43794 100644 --- a/module/ai/control.php +++ b/module/ai/control.php @@ -310,7 +310,7 @@ class ai extends control if(!empty($data->goTesting)) // Go to testing object view. { $location = $this->ai->getTestingLocation($prompt); - return $this->send(empty($location) ? array('result' => 'fail', 'message' => $this->lang->ai->prompts->goingTestingFail) : array('result' => 'success', 'message' => $this->lang->ai->prompts->goingTesting, 'locate' => $location)); + return $this->send(empty($location) ? array('result' => 'fail', 'target' => '#go-test-btn', 'msg' => $this->lang->ai->prompts->goingTestingFail) : array('result' => 'success', 'target' => '#go-test-btn', 'msg' => $this->lang->ai->prompts->goingTesting, 'locate' => $location)); } if($isJumpToNext) diff --git a/module/ai/view/promptsettargetform.html.php b/module/ai/view/promptsettargetform.html.php index 870d99f657..3f8b3f5b68 100644 --- a/module/ai/view/promptsettargetform.html.php +++ b/module/ai/view/promptsettargetform.html.php @@ -147,6 +147,28 @@ $(function() /* Enable buttons after going testing. */ $('#mainForm').ajaxForm({ + success: function(response, status) + { + var message = response.msg; + var location = response.locate; + var target = response.target ? response.target : '#submit'; + if(message) + { + var $targetSubmitBtn = $(target); + if($targetSubmitBtn.length) + { + $targetSubmitBtn.popover({ + container: 'body', + trigger: 'manual', + content: message, + tipClass: 'popover-in-modal popover-success popover-form-result', + placement: 'right', + }).popover('show'); + setTimeout(function() {$targetSubmitBtn.popover('destroy');}, 2000); + } + } + if(location) setTimeout(function() {$.apps.open(location);}, 1200); + }, finish: function(response, _, $form) { if(response.locate) setTimeout(function() {$.apps.open(response.locate);}, 1200);