Jump to content

Does Squarespace supports XHR request?

Recommended Posts

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)

Link to comment
  • Replies 3
  • Created
  • Last Reply

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.

About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. 
Content: Links in my posts may refer to SF Digital products or may be affiliate links.
If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too.

Link to comment


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



Link to comment

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)

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.