Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Does Squarespace supports XHR request?


Hi all, I am trying to execute API calls from Squarespace , and I was wondering if the dev platform supports XHR request?
Has anyone attempted this before? If yes, any working sample code?
I am using five template. 

I kept getting error below:

[Error] Failed to load resource: the server responded with a status of 500 (Internal Server Error) (login, line 0)

Share this post

Link to post

3 answers to this question

Recommended Posts

  • 0

Please provide a more detailed explanation of what you are trying to achieve, what you've tried so far and include a working link to the website. If the site isn't live, we need you to set a password in the visibility settings and tell us what it is.

Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Expert and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post

Link to post
  • 0


I have been getting error below. 
"HTTP 500 ERROR for XHR Request"
(See brief screenshot)

What I am trying to do:
1. Send API request from Squarespace to Splunk (www.splunk.com)
2. Click the button I should be able to see a list of apps in my Splunk server.

My example code: 
(under /template/pages/)
(created as static page)
    <meta charset="utf-8">
    <title>How to start a Splunk session</title>
    <squarespace:script type="text/javascript" src="jquery.min.js"></script>
    <squarespace:script type="text/javascript" src="splunk.js"></script>

    <script type="text/javascript" charset="utf-8">
    function displayApps() {
        var http = new splunkjs.ProxyHttp("/proxy");

        // Create a Service instance and log in
        var service = new splunkjs.Service(http, {
            username: "XXXX",
            password: "XXXX",
            scheme: "https",
            host: "XXXX",

        // Verify we logged in

        // Print installed apps to the console to verify login
        service.apps().fetch(function(err, apps) {
            if (err) {
                alert("Error listing apps");

            var myapps = "";
            var appsList = apps.list();
            for(var i = 0; i < appsList.length; i++) {
                myapps += "App " + i + ": " + appsList[i].name + "<br/>"


    <button type="button" onclick="displayApps()">Log in and list apps</button>
    <p id="applist"></p>

I have got two scripts under "/template/scripts"

splunk.js https://github.com/splunk/splunk-sdk-javascript/blob/master/client/splunk.js



Share this post

Link to post
  • 0

Squarespace won't prevent you from writing client-side JavaScript code that connects to external APIs. Therefore the issue must be something about your JavaScript or your settings in Splunk. I'm not familiar with the details of Splunk, but there is this (which you may have already reviewed).

If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' vote.jpg.c260784ece77aec852b0e3049c77a607.jpg (top-left)

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...