call php from ajax javascript -
i have php-based template website has been heavily modified.
i in process of adding rss feeds, of easy "interpret" , display satisfactorily 1 in caps "pre" formatting well.
i want modify content. @ mods make education , invariably able google satisfactory solutions problems come across but, despite earlier extensive programming background, without thorough grounding in javascript, ajax, php, css , html, there things frustrate hell out of me.
all want pass block of text javascript code php code, massage , result back. @ point in ajax/jscript function where...
items[i].content
...contains block of text want massaged , have piece of code got here, think, ostensibly calls php code...
function compute() { var params="session=123"; $.post('wxspellch.php',params,function(data){ alert(data);//for testing if data being fetched var myobject = eval('(' + data + ')'); document.getelementbyid("result").value=myobject(addend_1,addend_2); });
...and, unfortunately, isn't documented don't have clue has customized. have done far enter name of php script. php script written this...
$pspell = pspell_new('en','american','','utf-8',pspell_fast); function spellcheckword($word) { global $pspell; $autocorrect = true; // take string match preg_replace_callback's array $word = $word[0]; etc...... } function spellcheck($string) { return preg_replace_callback('/\b\w+\b/','spellcheckword',$string); } echo spellcheck("...... data .......")
the php tests out fine hard-coded data. need know further customizing have javascript , php in order facilitate passing , recovery of block of text.
Comments
Post a Comment