error is:- content is not a function. why the function is not called

Posted on 2009-07-13
Last Modified: 2012-05-07
error is:- content is not a function. why the function is not called





		$db_con=mysql_connect($db_host,$username,$password) or die("connection not build".mysql_error());

		$db=mysql_select_db($db_name) or die("database not build".mysql_error());


<script language="javascript" type="text/javascript">

function createObject() {

	var request_type;

	var browser = navigator.appName;

	if(browser == "Microsoft Internet Explorer"){

		request_type = new ActiveXObject("Microsoft.XMLHTTP");

	} else{

		request_type = new XMLHttpRequest();


	return request_type;


var http = createObject();

function content(){

	var content = encodeURI(document.getElementById('content').value);

	alert(content)'get','content.php?content='+content, true); 

	http.onreadystatechange = function(){

	if(http.readyState == 4){

		var response = http.responseText;

		document.getElementById('test').innerHTML = response;

		document.getElementById('test').style.display = 'block';







<table border="1" bgcolor="#CCCCCC" width="10%">

<tr><td colspan="2" align="center"><h2>Add Form</h2></td></tr>

<tr><td colspan="2">


		$sql = "select * from `fck`";

		$qid = mysql_query($sql) or die("could not select".mysql_error());


			echo $content_value = $rec['content'];




<tr><td><h4>Content</h4></td><td><input type="text" name="content" id="content" value="<?php echo $content_value; ?>" /></td></tr>

<tr><td colspan="2" align="center"><input type="button" name="button" value="Add" onclick="javascript:content()" /></td></tr>



<div id="test"></div>

Open in new window

Question by:designersx
  • 3
  • 2
LVL 41

Accepted Solution

HonorGod earned 125 total points
ID: 24839306
Because you reuse the variable name "content" as the name of your function,
then immediately within the function with this statement:

var content = encodeURI(document.getElementById('content').value);

Open in new window


Author Comment

ID: 24839432
yes sir solved that issue thanks

sir what is the meaning of the below error.

Catchable fatal error: Object of class stdClass could not be converted to string in C:\wamp\www\new\modified_cms\login\dat.php on line 39
LVL 29

Expert Comment

ID: 24839474
The function named "content", the variable named "content" within the function and the HTML element with the ID of "content" are separate entities and should *not* be a problem.

It is confusing as all get out, but it remains valid.



should be this:

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.


Author Comment

ID: 24839671
should be this:

with this the problem persists

you must have noticed that above i have input type=button , therefore the problem is coming, when i take input type=submit then problem does not come.

and my above gets solved when i apply ur first idea of changing the function name with the id.

ok no probs , now my problem is being solved thanks for that.
LVL 41

Expert Comment

ID: 24839805
I don't know that a stdClass is.  That is not a standard JavaScript object.
LVL 41

Expert Comment

ID: 24840045
Thank you for the grade & points.

Good luck & have a great day.

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now