Spaces:
Running
Running
Update index.html
Browse files- index.html +17 -2
index.html
CHANGED
|
@@ -198,8 +198,23 @@
|
|
| 198 |
}
|
| 199 |
} catch (error) {
|
| 200 |
resultDiv.innerHTML = `
|
| 201 |
-
<h3 class="error">Request
|
| 202 |
-
<p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
`;
|
| 204 |
} finally {
|
| 205 |
submitBtn.disabled = false;
|
|
|
|
| 198 |
}
|
| 199 |
} catch (error) {
|
| 200 |
resultDiv.innerHTML = `
|
| 201 |
+
<h3 class="error">CORS Error - Request Blocked</h3>
|
| 202 |
+
<p>The API doesn't allow direct browser requests. Here's the request info you need:</p>
|
| 203 |
+
<h4>Request Details:</h4>
|
| 204 |
+
<p><strong>URL:</strong> https://api.k12jobspot.com/api/Jobs/Search</p>
|
| 205 |
+
<p><strong>Method:</strong> POST</p>
|
| 206 |
+
<p><strong>Headers:</strong></p>
|
| 207 |
+
<pre>Content-Type: application/json</pre>
|
| 208 |
+
<p><strong>Body:</strong></p>
|
| 209 |
+
<pre>${JSON.stringify(requestBody, null, 2)}</pre>
|
| 210 |
+
<h4>Solutions:</h4>
|
| 211 |
+
<p>1. Use a backend server (Node.js, Python, etc.) to make the request</p>
|
| 212 |
+
<p>2. Use a CORS proxy service</p>
|
| 213 |
+
<p>3. Use tools like Postman or curl to test the API</p>
|
| 214 |
+
<p>4. Copy the curl command below:</p>
|
| 215 |
+
<pre>curl -X POST https://api.k12jobspot.com/api/Jobs/Search \\
|
| 216 |
+
-H "Content-Type: application/json" \\
|
| 217 |
+
-d '${JSON.stringify(requestBody)}'</pre>
|
| 218 |
`;
|
| 219 |
} finally {
|
| 220 |
submitBtn.disabled = false;
|