Show Some Love
PHP

ajax with JavaScript exception: unexpected end of input

This forum was posted on Wednesday, March 13, 2013 11:17:48 AM


I hv an input field for a logic and when the member fills it out he has to then checkout if the logic exists. So I made a checkout button which checks a DB using ajax and JavaScript to see if the logic exists. My issue is when using ajax and JavaScript I get this exception:
unexpected end of input
JS :

var logic = document.getElementById('acConceptName').value;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
var isexisted = JSON.parse(xmlhttp.responseText);
if(isexisted0==true){
var errorMessage = document.getElementById('acSuggesConcepts');
var p = document.createElement('p');
p.innerHTML="this logic is already existed";
errorMessage.appendChild(p);
errorMessage.style.display="block";
}
}
}
xmlhttp.open("GET" "http://localhost/Mar7ba/Ontology/isExistedConcept/"+concept+"/TRUE" true);
xmlhttp.send();

what's the exception and How do I fix it ?
PHP : function to checkout DB and I generally return true in it
public function isExistedConcept($concpetName $Ajax){
if($Ajax==true){
$results=true
$d=array($results);
return json_encode($d);
}
}

Demo: http://jsfiddle.net/Wiliam_Kinaan/s7Srx/2/


185 Viewed this Question



 Recent Replies on "ajax with JavaScript exception: unexpected end of input"

  • Nobody has replied on this post, be first to post answer.

Post Your Solution for this Question


Note: Please Put Code into <code></code> block.

Threads related to "ajax with JavaScript exception: unexpected end of input":

database check (for credentials) when using single sign-on (sso) for a web app, hint?

i wish to manipulate single sign-on (sso) in a management application we have but i wish to have a hint or two about it. In our current application a member logs in our application with a typical user+pass combination (with CAPTCHA being an optional feature).As far as I understand (if I did it perfectly) what you do with sso is 'trust' an identity provider (namely... Google facebook Yahoo! Windows Live etc.) so the member is performing the actual login in an external page and then it returns a value to me so I know the

htaccess coding 301 not working

I hv the following code snippet snippet in my .htacess fileOptions +FollowSymLinksRewriteEngine OnRewriteCond %{HTTP_HOST} ^(www\.)?waynecovell\.co.uk$ NCRewriteRule .* http://www.techonomic.com%{REQUEST_URI} R=301 LBut it does not appear to: - Redirect www.waynecovell.co.uk only waynecovell.co.uk - Redirect any sub items such as waynecovell.co.uk/contact for either versionI hv searched this site and used various variations of .htaccess code snippet snippet all to no avail.I was worried about duplicate conte

loading and inserting millions record in html file from php and mysql how

I hv html file of size upto 1GB. and i require to upload the content of this html file in database. the file(html) hold the tags. this work is done if a file size is approximate 5MB or 6MB but the large file size give me error of OUT OF MEMORY( xxxxx bytes) trying to allocate(xxxxxxx bytes)..How can i upload large file size data in database..i use DOMDocument -> LoadHTMLfile function.... and getElementByTagName("tr")

Lithium & phpActiveRecord - are my ACL associations correct?

i'm working with Lithium with phpActiveRecord using li3_activerecord.it's been a little years since I got back into ORM's and associations and I'm a little confused with my current ACL setup.Here are my tables and their associations simplified for brevity:members - $belongs_to role-----idrole_idemailROLES - $has_many permissions resources through permissions users-----idtitle (illustration: Admin member Guest)RESOURCES - $has_many roles permissions---------idcontroller (illustration: Members Products Cate

Callback order strange in JSON, AJAX

This could be just the approach it is. but I hv a call which loads an array via PHP:$gc_result = mysql_query($gc_query); while ($result = mysql_fetch_array($gc_result)) { $jsonURL = "https://graph.facebook.com/" . $result'user_id' . "/"; $json = json_decode(file_get_contents($jsonURL) true); $result"name" = $json'name'; $data = $result; } echo json_encode($data);This works best. The problem is I hv 3 types of query one for date DESC ASC and ID DESC. When it loads it int

PHP XML creator doesn't support Persian/Arabic encoding (UTF-8)

I hv a problem with my php XML generator class; I used XML Creator class :class _XmlWriter {var $xml;var $indent;var $stack = array();function _XmlWriter($indent = ' ') { $this->indent = $indent; $this->xml = '' . "";}function _indent() { for ($i = 0 $j = count($this->stack); $i $this->xml .= $this->indent; }}function push($element $attributes = array()) { $this->_indent(); $this->xml .= ' foreach ($attributes as $key => $value) { $this->xml .= ' ' . $key . '="' . htmlentities($

Anyone know why ReCaptcha may be styling wrong

Here is my page and the ReCaptcha error is obvioushttp://www.bookiebashers.org/register.phpAny solution to why it can be stretched. I am completly puzzled to why this can be happening.Any concept will be heartly apprised.Thanks

sql update statement doesn't work

I hv to increment a field in my DB always I execute this statement:$sql="UPDATE `product` SET buyCount = buyCount+1 WHERE id=".$productID;But it doesn't work. Any help ?

facebook apprequests : An error occurred. Please try again later

i'm working with this code snippet snippet to send app requests to members in my facebook app window.fbAsyncInit = function() { FB.init({ appId: '39764546513545342' status: true cookie: true oauth: true }); }; function invitetoevent(rid) { FB.ui({ method: 'apprequests' msg: 'i\'ll see you in this event.' title: 'Lets Go!.' filters: 'app_users' max_recipients: 25 } function (o/p) { if (o/p.request && o/p.to) { //actions } else { //alert('canceled'); }});}

write clean url's in php closed

i require to write my urls with this format of string :http://www.mysite.com/news/2012/10/04/article-titlebut when i use RewriteRule in htaccess file site styles don't work perfectly . I have it issue : what's the best approach to do this in php ?formerly i do this in asp.net whit rewrite module but now i can not do this I hv searched so various times and read various articles but still have this problem ....Thnk u a lot