Skip Navigation

[Resuelto] Ajax search not working

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
A custom search View worked when results are updated via a page reload, but not via ajax.

Solution:
This depends upon JavaScript, and so if there are JS errors on the page it will likely break such functionality.

Check the browser console for JS errors.

In this case the developer had dequeued jQuery which is loaded by WordPress itself and is required.

This support ticket is created hace 6 años, 9 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Este tema contiene 6 respuestas, tiene 2 mensajes.

Última actualización por davidR-12 hace 6 años, 9 meses.

Asistido por: Nigel.

Autor
Mensajes
#615810

I have a page here:

enlace oculto

Set to display the titles of a custom post type called 'testimonials'

The ajax search works when I use a submit button but when set to "AJAX results update when visitors change any filter values" nothing happens. My code is as follows:

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
	<label>[wpml-string context="wpv-views"]Countries[/wpml-string]</label>
	[wpv-control-post-taxonomy taxonomy="testimonial-country" type="select" url_param="wpv-testimonial-country"]
</div>
[/wpv-filter-controls]
[wpv-filter-end]

Regards,

David

#615892

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi David

I visited the page in question and saw that there are errors in your browser console.

Specifically, 'jQuery is not defined'.

You only have a single script enqueued on the page (wp-embed.min.js).

jQuery is automatically loaded by WordPress and required by Toolset.

Something on your site is blocking even the default scripts from being loaded.

#615906

Hi Nigel,

Does that mean that jQuery itself is not being loaded?

David

#615910

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Yes, exactly.

Disable all of your other plugins and switch themes and I expect you will see it is working.

#615925

How does Ajax work with the submit button if there is no jQuery?

#615933

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Screen Shot 2018-02-14 at 10.01.49.png

It can't.

You need to establish why jQuery—which is automatically loaded by WordPress—is not being included on your site.

In my screenshot you can see a plain vanilla WordPress install with no plugins showing the Hello World! post using the twentyseventeen theme.

WordPress loads several scripts.

Toolset functionality which requires JavaScript won't work if jQuery is missing from your site.

#615972

Hi Nigel,

I discovered that a previous developer had dequeued jQuery so removed the code and yes its all working fine now. Thank you for your help.

Regards,

David