Get and Post data to/from nicepage

skylab
4 Posts
skylab posted this 03 August 2023
Ask a Question

I'm trying to evaluate this product for my company. I like what I see, but I have a couple hold ups and can't seem to find a solution to. If you have ideas, existing processes, or thoughts, I'd greatly appreciate it.

  1. Is there a way to post/get data from a backend source? Preferably it would be a means to get/post directly from the page or site. The results would come across in the get and be able to use javascript on the page to update elements/data/etc.
  2. Is there a way to use javascript at a page level, perhaps a script library reference from which a function can be called? Are script tags supported. I ask because simple test in an html block gives an error:

<input type="button" value="Testing" onclick="popNow()"> <script>function popNow() {alert( "wow" );}</script>

Thank you for your help.

I'm trying to evaluate this product for my company. I like what I see, but I have a couple hold ups and can't seem to find a solution to. If you have ideas, existing processes, or thoughts, I'd greatly appreciate it. 1. Is there a way to post/get data from a backend source? Preferably it would be a means to get/post directly from the page or site. The results would come across in the get and be able to use javascript on the page to update elements/data/etc. 2. Is there a way to use javascript at a page level, perhaps a script library reference from which a function can be called? Are script tags supported. I ask because simple test in an html block gives an error: > &lt;input type="button" value="Testing" onclick="popNow()"&gt; &lt;script&gt;function popNow() {alert( "wow" );}&lt;/script&gt; Thank you for your help.

Last edited 03 August 2023 by skylab

Vote to pay developers attention to this features or issue.
7 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 03 August 2023

Hello,

Thank you for considering Nicepage for your company and for sharing your questions and concerns. We will do our best to provide some insights and information to address your queries:

  1. Post/Get Data from a Backend Source:
    Unfortunately, Nicepage does not have built-in capabilities for direct server-side communication, like posting/getting data from a backend source. However, you can incorporate third-party tools or custom code to achieve this functionality.

    • For example, you can use JavaScript and AJAX to send HTTP requests to your backend API or server to retrieve or submit data. You can create custom JavaScript functions and embed them within your web pages created with Nicepage.

    • Additionally, if you are using a content management system (CMS) like WordPress or Joomla, you can integrate plugins or modules that provide backend data communication features.

  2. Using JavaScript at a Page Level: Yes, you can use JavaScript at a page level in Nicepage. When you design your webpage in Nicepage, you can add custom HTML elements, and within those blocks, you can include script tags to execute JavaScript functions.

    • For example, check how you can use the provided code:

The first part of the code is placed in the HTML element.

1rtgs.png

The script you should insert in the Page Settings >> HTML >> Additional Head HTML

2gbh.png

  • The code you provided should work as expected, and it will show an alert box with the message "wow" when the button is clicked.

Please keep in mind that Nicepage primarily focuses on the design aspect of webpages, and while it supports custom code integration, more advanced functionalities like direct server communication require additional development and integration efforts.

If you have specific requirements or need assistance with implementing certain features, we recommend discussing your needs with a web developer who can help customize your web pages or integrate necessary functionalities.

If you have any other questions or need further assistance, please feel free to ask. We're here to help you make the most of your evaluation of Nicepage.
...................................................
Sincerely,
Ahmad.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello, Thank you for considering Nicepage for your company and for sharing your questions and concerns. We will do our best to provide some insights and information to address your queries: 1. **Post/Get Data from a Backend Source:** Unfortunately, Nicepage does not have built-in capabilities for direct server-side communication, like posting/getting data from a backend source. However, you can incorporate third-party tools or custom code to achieve this functionality. - For example, you can use JavaScript and AJAX to send HTTP requests to your backend API or server to retrieve or submit data. You can create custom JavaScript functions and embed them within your web pages created with Nicepage. - Additionally, if you are using a content management system (CMS) like WordPress or Joomla, you can integrate plugins or modules that provide backend data communication features. 2. **Using JavaScript at a Page Level:** Yes, you can use JavaScript at a page level in Nicepage. When you design your webpage in Nicepage, you can add custom HTML elements, and within those blocks, you can include script tags to execute JavaScript functions. - For example, check how you can use the provided code: The first part of the code is placed in the HTML element. !1rtgs.png! The script you should insert in the **Page Settings >> HTML >> Additional Head HTML** !2gbh.png! - The code you provided should work as expected, and it will show an alert box with the message "wow" when the button is clicked. Please keep in mind that Nicepage primarily focuses on the design aspect of webpages, and while it supports custom code integration, more advanced functionalities like direct server communication require additional development and integration efforts. If you have specific requirements or need assistance with implementing certain features, we recommend discussing your needs with a web developer who can help customize your web pages or integrate necessary functionalities. If you have any other questions or need further assistance, please feel free to ask. We're here to help you make the most of your evaluation of Nicepage. ................................................... Sincerely, Ahmad. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
skylab
4 Posts
skylab posted this 03 August 2023

https://resources.nicepage.com/552/112552/Capture.PNG

enter image description here

I get this error when I click the button. I've put the button in an html block as you've directed. I've tried putting the function inside the html block and at the page settings level as shown, but the same error occurs.

enter image description here

enter image description here

enter image description here
https://resources.nicepage.com/552/112552/Capture.PNG ![enter image description here][1] I get this error when I click the button. I've put the button in an html block as you've directed. I've tried putting the function inside the html block and at the page settings level as shown, but the same error occurs. ![enter image description here][2] ![enter image description here][3] ![enter image description here][4] [1]: https://resources.nicepage.com/552/112552/Capture.PNG [2]: https://resources.nicepage.com/553/112553/Capture1.PNG [3]: https://resources.nicepage.com/554/112554/Capture2.PNG [4]: https://resources.nicepage.com/555/112555/Capture3.PNG
Support Team
Support Team posted this 05 August 2023

Hi,

Please find enclosed attachments below.

Project - Test-button-Project.zip and exported HTML website - Testing-HTML.zip

Thank you
...................................................
Sincerely,
Ahmad.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, Please find enclosed attachments below. Project - ***Test-button-Project.zip*** and exported HTML website - ***Testing-HTML.zip*** Thank you ................................................... Sincerely, Ahmad. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
skylab
4 Posts
skylab posted this 07 August 2023

Um, the "Test button project" still throws the same error.
Using "Export/Import" to import the "testing-html" zip says: "invalid nicepage project file"

Thoughts?

Um, the "Test button project" still throws the same error. Using "Export/Import" to import the "testing-html" zip says: "invalid nicepage project file" Thoughts?
Support Team
Support Team posted this 07 August 2023

Hello,

We've published the project Test button project. Update your browser and clear the cache from your browser.
https://testing-button.nicepage.io/

Here's screen recording video how the buttons are working
https://somup.com/c0jiDMAcY4

Using "Export/Import" to import the "testing-html" zip says: "invalid nicepage project file"

It's not a project at all. This is an exported HTML website.
...................................................
Sincerely,
Ahmad.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello, We've published the project Test button project. Update your browser and clear the cache from your browser. https://testing-button.nicepage.io/ Here's screen recording video how the buttons are working https://somup.com/c0jiDMAcY4 >Using "Export/Import" to import the "testing-html" zip says: "invalid nicepage project file" It's not a project at all. This is an exported HTML website. ................................................... Sincerely, Ahmad. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
skylab
4 Posts
skylab posted this 08 August 2023

Ok. I get it. It must be published in order to actually use the custom code. I get it, and thank you for that.

I've continued on and attempted to run AJAX queries through custom html/javascript. I discovered that putting "javascript:function()" in the url of the button allowed it to run a function even though it seems you all left such a critical aspect of web development at the curb.

However, I am now stuck trying to either get the page to allow or find the problem behind the ajax query. The code I've used on other platforms/sites outside of NicePage, so I know it works. Basically the javascript is attempting to submit this url:
https://www.pnp360.net/smdb.nsf/AJAX?OpenAgent&Action=ValidateUser&ID=c2t5bGFiZ29nb2dv
and get a response from it.

However, when the url gets send via xmlhttprequest, I get this error (see image)
http://www.ironclads.com/temp/screencapture1.png

Here's the NicePage site as well: http://www.ironclads.com/temp/smdb.zip

My question is, how is it possible to run an xmlhttprequest and receive a response with NicePage?
Thank you again for your help.

I like what I'm seeing but I need to overcome a few more hurdles before I can say, "let's start using this product". Thank you.

Ok. I get it. It must be published in order to actually use the custom code. I get it, and thank you for that. I've continued on and attempted to run AJAX queries through custom html/javascript. I discovered that putting "javascript:function()" in the url of the button allowed it to run a function even though it seems you all left such a critical aspect of web development at the curb. However, I am now stuck trying to either get the page to allow or find the problem behind the ajax query. The code I've used on other platforms/sites outside of NicePage, so I know it works. Basically the javascript is attempting to submit this url: https://www.pnp360.net/smdb.nsf/AJAX?OpenAgent&Action=ValidateUser&ID=c2t5bGFiZ29nb2dv and get a response from it. However, when the url gets send via xmlhttprequest, I get this error (see image) http://www.ironclads.com/temp/screencapture1.png Here's the NicePage site as well: http://www.ironclads.com/temp/smdb.zip My question is, how is it possible to run an xmlhttprequest and receive a response with NicePage? Thank you again for your help. I like what I'm seeing but I need to overcome a few more hurdles before I can say, "let's start using this product". Thank you.
Support Team
Support Team posted this 09 August 2023

Hello,

Ok. I get it. It must be published in order to actually use the custom code. I get it, and thank you for that.

It works even without publishing. You can test it with exported HTML website from above - Testing-HTML.zip

Regarding your question about running XMLHttpRequest (AJAX) requests and receiving responses within Nicepage, here are some insights:

  • Published Website: As you've mentioned earlier, custom code, including JavaScript, needs to be published in order to be fully
    functional. Nicepage's visual editor is designed to ensure security
    and stability while editing, so certain features are active only when
    the website is published.

  • Cross-Origin Policy: The error you're encountering with the XMLHttpRequest could be related to the browser's same-origin policy, which restricts web pages from requesting a different domain. This is
    a security measure to prevent malicious activities. In your case, it
    seems like you're trying to access a different domain than your own.
    To overcome this, you might need to set up CORS (Cross-Origin
    Resource Sharing) on the server that you're making the request to.

  • Webpage Structure: The success of an AJAX request might also depend on the web page's structure. If you're trying to fetch data from a different domain, ensure that the server on that domain allows
    such requests and returns the data in the appropriate format.

  • Console Logs and Debugging: To troubleshoot the issue, you can use the browser's developer tools (usually opened with F12 or Ctrl+Shift+I) to check for any error messages in the console tab.
    This might provide more information about why the request is failing.

Please note that Nicepage provides tools for visual web design and doesn't offer in-depth backend development capabilities. If your project requires advanced AJAX interactions, you might need to integrate your Nicepage-designed pages into a more comprehensive web development environment.

If you have further questions or need assistance, please don't hesitate to reach out.
...................................................
Sincerely,
Ahmad.
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hello, >Ok. I get it. It must be published in order to actually use the custom code. I get it, and thank you for that. It works even without publishing. You can test it with exported HTML website from above - ***Testing-HTML.zip*** Regarding your question about running XMLHttpRequest (AJAX) requests and receiving responses within Nicepage, here are some insights: - **Published Website:** As you've mentioned earlier, custom code, including JavaScript, needs to be published in order to be fully functional. Nicepage's visual editor is designed to ensure security and stability while editing, so certain features are active only when the website is published. - **Cross-Origin Policy:** The error you're encountering with the XMLHttpRequest could be related to the browser's same-origin policy, which restricts web pages from requesting a different domain. This is a security measure to prevent malicious activities. In your case, it seems like you're trying to access a different domain than your own. To overcome this, you might need to set up CORS (Cross-Origin Resource Sharing) on the server that you're making the request to. - **Webpage Structure:** The success of an AJAX request might also depend on the web page's structure. If you're trying to fetch data from a different domain, ensure that the server on that domain allows such requests and returns the data in the appropriate format. - **Console Logs and Debugging:** To troubleshoot the issue, you can use the browser's developer tools (usually opened with F12 or Ctrl+Shift+I) to check for any error messages in the console tab. This might provide more information about why the request is failing. Please note that Nicepage provides tools for visual web design and doesn't offer in-depth backend development capabilities. If your project requires advanced AJAX interactions, you might need to integrate your Nicepage-designed pages into a more comprehensive web development environment. If you have further questions or need assistance, please don't hesitate to reach out. ................................................... Sincerely, Ahmad. Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
You must log in or register to leave comments