jquery - Django Ajax Values Returned but Not Being Displayed in Drop-down List -
I have a simple search box, where I use Ajax to display the blog title in the drop down suggestion list I am
I have not found any errors and when I observe the Any suggestions? p> urls.py View P> ajax_search.html articles.html base.html ajax.js I do not know how this is necessary because it was a typical error rational And probably does not apply to many people, so to come along with the next person, this is probably not the solution for you, but it can be a good lesson whenever you have a bug everywhere Looking for and you are sure that you have done everything right, take a break, with fresh eyes Having come back to the problem is not it, where is it that you think. In this case, he was not missing the absence of success (A) from his search where Edit: Also, on the development server of the Django I have participated in problems with AJAX and one or two other functions, where the effect of the code restriction changes is sometimes you get the server, the terminal The machine must be restarted (I recommend it in that order) element & gt; Network & gt; Feedback via browser
DIF search_charts (request): if request.method == "POST": search_text = request.POST ['search_text'] other: search_text = '' article = article. Afs. Failter (title_Icient = search_text) Returns Render_ot_proning ('ajax_search.html', {'article': article})
{% extended "base.html"%} {% block sidebar %} & Lt; H3 & gt; Search & lt; / H3 & gt; {% Csrf_token%} & lt; Input type = "text" id = "search" name = "search" & gt; & Lt; ul id = "search-results" & gt; & Lt; / Ul & gt; {% Endblock%}
{% load stable%}
$ (function () {$ ('#search'). ( Function () {$ .ajax ({type: "POST", url: "/ article / search /", data: {'search_text': $ ('# search'). Val (), 'csrfmiddletw': $ ( "Input [name = csrfmiddletoken]"). Val ()}, success: searchSuccess, datatype: 'html'});});}); Function Searchshoot (data, textstats, jquxhr) {$ ('# serch-results') Html (data); }
$ ('serch-results')
$ (' search - Result) .
Comments
Post a Comment