Hot answers tagged

5

Problem "Serialization" is the act of turning a data-object into a string-representation. jQuery automatically serializes the data property before sending an AJAX request. The server then deserializes the GET querystring from the URL, and the request body for POST requests before populating PHP's request variables. Your code functioned as expected when ...


2

I guess the issue with this line: $path = "wp-content/themes/creation/templates/inc/log.txt"; You need to use the full path, not a relative part, while using fopen() or file_exists(). Something like this should fix your issue: $path = get_template_directory() . "/templates/inc/log.txt"; get_template_directory() will return the absolute server path, ...


2

From your site i can say that script is not being loaded because of wrong opening quote for script tag.Use " instead of ” So <script src=”http://lookbook.nu/widget/profile.js?id=2303472&width=standard&align=left&stats_fans=1&fanbox=yes&hash=14575a9cd02fd36d2758e5db3cb92b5a”></script> Should be this <script ...


2

Note that the action should be inside the data key. In your post request there is no key named as action therefore, the callback function is never being called. Consider this example:- jQuery.ajax({ type:"POST", url: "/wp-admin/admin-ajax.php", data: { action: "my_test_action", form_data : newFormChange }, success: ...


1

Uncaught TypeError: Cannot read property 'ajax' of undefined @Sasa1234, it happen cause your jQuery is undefined. Please take a look @EAMann answer. So, your JS code should like this: function myajaxfunction() { if ( undefined !== window.jQuery ) { jQuery.ajax({ //ajax request url: ajaxurl, data: { ...


1

After struggling with it, found the solution which works, in a callback after you add new element: tinymce.execCommand( 'mceAddEditor', true, element.id ); Its strange that there is zero documentation inside codex.


1

Simple answer: Don't add a separate PHP file for AJAX requests. Declare the functions that will be used in your plugin and load them via admin-ajax.php. add_action('wp_ajax_custom_action_name','custom_action_handler'); // to make AJAX action available for non-logged in users: add_action('wp_ajax_nopriv_custom_action_name','custom_action_handler'); function ...


1

I see two things. You're missing an action call - you need add_action( 'wp_ajax_render_admin_charts_page', 'render_admin_charts_page' ); add_action('wp_ajax_nopriv_render_admin_charts_page', 'render_admin_charts_page'); Plus, from looking at your render_admin_charts_page() you need to change your json dataType to html. Your charts function is outputting ...


1

There is no action variable on the data you're passing to Ajax. This way WordPress is sending just a generic call to Ajax which always return 0. You must edit your data on your JS file to something like: data: { 'user_input': user_input_last, 'action': 'tags_autofill_function' },



Only top voted, non community-wiki answers of a minimum length are eligible