Skip to content

Forum in maintenance, we will back soon 🙂

Create Custom Tools...
 
Notifications
Clear all

Create Custom Tools on WordPress training module > Test Your Ajax Function Error

54 Posts
5 Users
12 Reactions
884 Views
(@wiscochris)
Posts: 28
Member
Topic starter
 

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.

 
Posted : 04/08/2024 11:07 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@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

 
Posted : 04/08/2024 12:19 pm
(@wiscochris)
Posts: 28
Member
Topic starter
 

Hi @ssadvisor I see no errors https://app.screencast.com/dv48YiOR9wEcf

 
Posted : 04/08/2024 12:42 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

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. 

 
Posted : 04/08/2024 12:47 pm
(@wiscochris)
Posts: 28
Member
Topic starter
 

@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?

 
Posted : 04/08/2024 2:50 pm
(@husein)
Posts: 550
Member Moderator
 

@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/

 
Posted : 04/09/2024 11:27 am
SSAdvisor reacted
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

@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.

 
Posted : 04/09/2024 12:45 pm
(@wiscochris)
Posts: 28
Member
Topic starter
 

@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

 
Posted : 04/10/2024 11:45 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

Thanks!

I see in the JS file, the action name doesn't match the one on WordPress. it must be the same function name

 
Posted : 04/12/2024 8:44 am
(@wiscochris)
Posts: 28
Member
Topic starter
 

@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');
to
  data.append('action', 'openai_generate_text_basic');
and now both work perfectly 

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.

 
Posted : 04/12/2024 12:15 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

@wiscochris perfect!

 
Posted : 04/12/2024 12:16 pm
(@wiscochris)
Posts: 28
Member
Topic starter
 

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? 

 
Posted : 04/16/2024 12:35 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@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

 
Posted : 04/16/2024 1:10 pm
(@wiscochris)
Posts: 28
Member
Topic starter
 

@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?

 
Posted : 04/16/2024 1:25 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@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

 
Posted : 04/17/2024 2:59 am
Page 2 / 4
Share:
[the_ad_group id="312"]