html - Write non form data to xml using php -


i coding video platform. when sees video , hit button should incremented 1 , should written xml file - want php. , when symbol clicked, php should not loaded should executed.

here code:

html:

<a href='#' onclick='dolike(id)'><i class='material-icons'        style='float:bottom'>thumb_up</i></a> 

javascript:

function dolike(id){ $.ajax({     type: "post",     async: true,     url: "likup.php",     cache: false,     contenttype: false,     processdata: false,     error: function(){alert('cannot reach file');},     success:             function(){                 alert("saved successfully");             } });} 

php:

error_reporting(e_all); $file = 'xml/shortfilm/filmname.xml'; $xml = simplexml_load_file($file); $xml->shortfilm[0]->like= 2; 

but still unable achieve want.

onclick='dolike(id)' 

on click dolist(id) called. id? defined? need make sure parameter has correct value. dolike not send id server. need send it, otherwise server not receive it. server, in turn should process request , save xml.


Comments

Popular posts from this blog

Unlimited choices in BASH case statement -

Redirect to a HTTPS version using .htaccess -

javascript - jQuery: Add class depending on URL in the best way -