Click here to Skip to main content
15,899,754 members
Home / Discussions / Article Writing
   

Article Writing

 
AnswerRe: Obsolete article? Pin
Sean Ewington28-Jun-21 0:58
staffSean Ewington28-Jun-21 0:58 
GeneralRe: Obsolete article? Pin
Nelek28-Jun-21 3:09
protectorNelek28-Jun-21 3:09 
Questionthe "not ready to publish" article is back (was it removed ?), and it is still a mess Pin
BillWoodruff25-Jun-21 7:03
professionalBillWoodruff25-Jun-21 7:03 
AnswerRe: the "not ready to publish" article is back (was it removed ?), and it is still a mess Pin
Sean Ewington25-Jun-21 7:08
staffSean Ewington25-Jun-21 7:08 
GeneralRe: the "not ready to publish" article is back (was it removed ?), and it is still a mess Pin
BillWoodruff25-Jun-21 7:29
professionalBillWoodruff25-Jun-21 7:29 
GeneralRe: the "not ready to publish" article is back (was it removed ?), and it is still a mess Pin
Nelek25-Jun-21 8:36
protectorNelek25-Jun-21 8:36 
GeneralRe: the "not ready to publish" article is back (was it removed ?), and it is still a mess Pin
BillWoodruff25-Jun-21 20:06
professionalBillWoodruff25-Jun-21 20:06 
QuestionToo many attributes. There is a limit of 8. Pin
CodeErgoSum24-Jun-21 14:06
CodeErgoSum24-Jun-21 14:06 
AnswerRe: Too many attributes. There is a limit of 8. Pin
Matthew Dennis24-Jun-21 16:01
sysadminMatthew Dennis24-Jun-21 16:01 
GeneralRe: Too many attributes. There is a limit of 8. Pin
Richard Deeming24-Jun-21 21:28
mveRichard Deeming24-Jun-21 21:28 
GeneralRe: Too many attributes. There is a limit of 8. Pin
CodeErgoSum24-Jun-21 22:05
CodeErgoSum24-Jun-21 22:05 
AnswerRe: Too many attributes. There is a limit of 8. Pin
CodeErgoSum24-Jun-21 22:02
CodeErgoSum24-Jun-21 22:02 
Questionarticle published that the author says is not ready to be published Pin
BillWoodruff21-Jun-21 16:11
professionalBillWoodruff21-Jun-21 16:11 
AnswerRe: article published that the author says is not ready to be published Pin
Nelek22-Jun-21 0:16
protectorNelek22-Jun-21 0:16 
QuestionHow to implement live search using fetch method on my test website ? Pin
Firaki1234526-May-21 5:14
Firaki1234526-May-21 5:14 
Hi so i am using python Django and using JavaScript with the help of fetch method but i am stuck can anyone please help Frown | :(

My python views File:

Python
def Data(request):
	items = Post.objects.all()

	data = []

	for qs in items:

		I = {"title":qs.title,
			 "content": qs.content,
			 "image": qs.image.url,
			}
		data.append(I)

	return JsonResponse({"data":data})



My Search_results HTML FILE:


HTML
{% extends 'blog/base.html' %}

{% load static %}

{% block content %}

<div class = 'w-100 text-center'>

<h1>Search Results</h1>


<form id = "search-form" autocomplete="off">
	{% csrf_token %}
  <input name = 'game' type="text" id = "search-input" placeholder= "Post Search..">
</form>

<div id = "results-box" class = "results-card"> 
</div> 

</div>


	


{% endblock content %}


{% block js %}


<script defer src="{% static 'blog/S1.js' %}"> </script>


{% endblock js %}




My JS FILE:


console.log('Heelowwww')


const url = window.location.href

const searchForm = document.getElementById("search-form")
const searchInput = document.getElementById("search-input")
const resultsBox = document.getElementById("results-box")


const csrf = document.getElementsByName("csrfmiddlewaretoken")[0].value




options = {method: "GET",
		   headers: {
		   	Accept: "application/json"
		   },
		   data:{
		   	'csrfmiddlewaretoken': csrf,
			// 'game':searchInput,
		   }
}





const SearchPosts = async SearchIt => {
const res = await fetch("http://localhost:8000/data/",options)
const Posts = await res.json()

S = Posts["data"]


let matches = S.filter(post =>{
const regex = new RegExp(`^${SearchIt}`, 'gi')
return post.match(regex)
})
 	console.log(matches)

}


searchInput.addEventListener('input', () => SearchPosts(searchInput.value))



I get Filter is not a fucntion/method error

i am getting back an object so how can i do this Frown | :(

sorry a beginner in javascript

AnswerRe: How to implement live search using fetch method on my test website ? Pin
Sean Ewington26-May-21 5:22
staffSean Ewington26-May-21 5:22 
QuestionSean, can I edit someone else's article while it's in draft? Pin
OriginalGriff25-May-21 8:36
mveOriginalGriff25-May-21 8:36 
AnswerRe: Sean, can I edit someone else's article while it's in draft? Pin
Sean Ewington25-May-21 8:43
staffSean Ewington25-May-21 8:43 
GeneralRe: Sean, can I edit someone else's article while it's in draft? Pin
OriginalGriff25-May-21 9:05
mveOriginalGriff25-May-21 9:05 
GeneralRe: Sean, can I edit someone else's article while it's in draft? Pin
Sean Ewington26-May-21 1:30
staffSean Ewington26-May-21 1:30 
GeneralRe: Sean, can I edit someone else's article while it's in draft? Pin
OriginalGriff26-May-21 2:02
mveOriginalGriff26-May-21 2:02 
GeneralRe: Sean, can I edit someone else's article while it's in draft? Pin
Sean Ewington26-May-21 2:15
staffSean Ewington26-May-21 2:15 
GeneralRe: Sean, can I edit someone else's article while it's in draft? Pin
OriginalGriff25-May-21 9:06
mveOriginalGriff25-May-21 9:06 
QuestionHas the monthly article competition been discontinued? Pin
Shao Voon Wong23-May-21 19:50
mvaShao Voon Wong23-May-21 19:50 
AnswerRe: Has the monthly article competition been discontinued? Pin
Sean Ewington24-May-21 5:08
staffSean Ewington24-May-21 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.