Skip to content

Commit 41ec706

Browse files
update
1 parent 7730b52 commit 41ec706

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/Validator.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function save($closure)
133133
if ($this->jsonResponse instanceof \Symfony\Component\HttpFoundation\JsonResponse) {
134134
// Send headers/body only once and return response for frameworks/tests
135135
if (!$this->responseSent) {
136-
$this->jsonResponse->send();
136+
// $this->jsonResponse->send();
137137
$this->responseSent = true;
138138
}
139139
return $this->jsonResponse;
@@ -144,20 +144,27 @@ public function save($closure)
144144
// save into a remembering variable
145145
ValidatorMethod::resolveFlash($this);
146146

147-
$result = $this->callback($closure);
147+
$response = $this->callback($closure);
148148

149149
// If user returns a JsonResponse in save, send and return it
150-
if ($result instanceof \Symfony\Component\HttpFoundation\JsonResponse) {
150+
if ($response instanceof \Symfony\Component\HttpFoundation\JsonResponse) {
151151
if (!$this->responseSent) {
152-
$result->send();
152+
$response->send();
153153
$this->responseSent = true;
154154
}
155-
return $result;
155+
// return $response;
156+
157+
var_dump(
158+
'sent method'
159+
);
160+
exit();
156161
}
157162

158163
// delete csrf session token
159164
CsrfToken::unsetToken();
160165
}
166+
167+
return $this;
161168
}
162169

163170
/**

tests/index_ajax.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ function submitForm(form){
9090
.then(response => response.text())
9191
.then(data => {
9292
// parse the JSON response
93-
data = JSON.parse(data);
93+
// data = JSON.parse(data);
9494

9595
console.log(
9696
data,
97-
data.response,
98-
data.message
97+
// data.response,
98+
// data.message
9999
);
100100
return false;
101101
// handle success/error response from server

0 commit comments

Comments
 (0)