Forum in maintenance, we will back soon 🙂
Create Custom Tools on WordPress training module > Test Your Ajax Function Error
thanks @husein . When I comment out that code https://app.screencast.com/k1OxBf8Rggh1e the ajax test looks like this: https://app.screencast.com/YBALd6v5N5rhs and the result from my Youtube title generator page looks like this https://app.screencast.com/YGUN44BPH7J24 . Any further insights/guidance would be appreciated.
@wiscochris if you use the "inspect" function of the browser do you see any errors reported? You can find the "inspect" function when you right mouse click the browser window.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
Hi @ssadvisor I see no errors https://app.screencast.com/dv48YiOR9wEcf
Hi @wiscochris.
let's go step by step with this.
forget about the UI now. and let's make sure the backend function is working. so did you test with Reqbin? or VS code extension? and it worked?
if yes, we can see what is going on with the UI.
@admin /Hason. thanks for the reply. While I have VS code installed, I do not have any idea / knowlege of how I would proceed to test this. Can you possibly give me some guidance / a step by step?
@wiscochris try installing the thunder client extension on vs code. And, test your backend function as shown in this video: https://learnwithhasan.com/lessons/generate-with-wordpress-snippets/
@wiscochris I showed how to test step by step in this course: https://learnwithhasan.com/learn/build-and-sell-ai-tools/
can you check please.
@admin thanks for the guidance on that. I am following the course that you directed me to and in that course I am running into an an issue with that exercise which may help identify the issue I am having with the SAAS course. If you don't mind, I describe the issue in this video. https://app.screencast.com/IMWdR1fc3LUay
Thanks!
I see in the JS file, the action name doesn't match the one on WordPress. it must be the same function name
@admin Thank you Hasan. In both in the example script.js file and in the WordPress Hook Generator JavaScript, I updated
data.append('action', 'generate_text_basic');
data.append('action', 'openai_generate_text_basic');
I will now apply what I have learned about testing per your prompt here https://learnwithhasan.com/premium-forum/points-system/create-custom-tools-on-wordpress-training-module-test-your-ajax-function-error/paged/2/#post-2000 and will continue here with feedback if that test does not make the issue / fix obvious to me.
Hi, Again, I was able to progress through the last issue in this course but I'm running into another and would appreciate your help:
I am currently here https://app.screencast.com/5ykEb9awc18eH in the course. I am trying to add this php code snippet https://learnwithhasan.com/custom-code/generate-titles-with-openai/ per the instruction. here is a screenshot of what I have input prior to attempting to "Save Snippet". https://app.screencast.com/7EIoNvdDdZ9ed The issue is that when I do click on "Save Snippet" I get this error in WP 🙁 https://app.screencast.com/nNgyXXZMSZei4 . When I click on the "View Snippets with Errors" button in that error I get https://app.screencast.com/KTwcvU6NWQaKz . When I go back to the list of all code snippets, that snippet is not in the list/was not saved 🙁 https://app.screencast.com/PXyO7IhXZQqq6 Can you please help me troubleshoot?
@wiscochris this is a simple case of having the same function name in more than one snippet. You can rename the offending duplicate name and make sure to change the uses of the function to the new name.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@ssadvisor Thanks very much. That worked for saving. My next issue is that I have the snippet set up as follows: https://app.screencast.com/6ONZmkfIujZkO (including my own Open API key - and note that I updated the function name in all necessary locations in the code.) The ajax test is generating this error 🙁 https://app.screencast.com/mBFHsFYhU6MwT . When testing the function this is the result 🙁
https://www.ai.myleadhero.com/wp-admin/admin-ajax.php?action=openai_generate_text2&topic=SEO and AI
https://app.screencast.com/z7Hfa9H46qaFs
note that i have confirmed that the open AI API is correct and that I have credits available https://app.screencast.com/rhx2RtdTxB6jS
Can you help me troubleshoot, please?
@wiscochris the admin-ajax script is complaining that it cannot find the function. When I remove the 2 from the end of the action name the server returns data. Your first picture didn't show the full snippet code, maybe a problem further in the snippet. If you go to the list of snippets and deactivate then reactivate the snippet is there a problem?
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack